本文整理汇总了PHP中mysqli::Query方法的典型用法代码示例。如果您正苦于以下问题:PHP mysqli::Query方法的具体用法?PHP mysqli::Query怎么用?PHP mysqli::Query使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mysqli
的用法示例。
在下文中一共展示了mysqli::Query方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: die
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$id = $_SESSION['id'];
if ($_POST['submit'] == 'next') {
$id = $id + 50;
} else {
if ($_POST['submit'] === 'previous') {
$id = $_SESSION['id'] - 50;
}
}
$ifRan = true;
$Query = $_SESSION['Query'];
if ($ifRan == true) {
echo $Query . ' limit ' . $id . ',50';
$fQuery = $conn->Query($Query . ' limit ' . $id . ',49');
echo '<table border=1>';
echo '<th>Transfer Date <br />&<br />Parcel Number</th>
<th>Conveyance <br /> Number</th>
<th>To <br />& <br /> From</th>
<th>Acres,<br /> Legal Description<br /> & <br /> Property Address </th>
<th>Sale Amount<br /> &<br /> Land Use </th>';
for ($i = 0; $i < $fQuery->num_rows; ++$i) {
$result = $fQuery->fetch_array();
echo '<tr>';
echo '<td>';
echo $result['mtransferDate'] . "<br />";
echo $result['SourceParcel'];
echo '</td>';
echo '<td>';
echo $result['mconveyanceNumber'];
示例2: QCliParameterProcessor
<?php
$objParameters = new QCliParameterProcessor('growth-group-import', 'ALCF Growth Group Importer Script');
$objParameters->AddDefaultParameter('server', QCliParameterType::String, 'Server/Host of the MySQL Database');
$objParameters->AddDefaultParameter('dbname', QCliParameterType::String, 'Database Name of the MySQL Database');
$objParameters->AddDefaultParameter('username', QCliParameterType::String, 'Username of the MySQL user');
$objParameters->Run();
$objMySqli = new mysqli($objParameters->GetDefaultValue('server'), $objParameters->GetDefaultValue('username'), null, $objParameters->GetDefaultValue('dbname'));
$objMinistry = Ministry::LoadByToken('growth');
if (!$objMinistry) {
exit('No GG Ministry Found');
}
$objResult = $objMySqli->Query('SELECT * FROM growth_group_structure order by id;');
while ($objRow = $objResult->fetch_array()) {
$objStructure = new GrowthGroupStructure();
$objStructure->Name = $objRow['name'];
$objStructure->Save();
}
$objResult = $objMySqli->Query('SELECT * FROM growth_group_location order by id;');
$objParentGroupArray = array();
while ($objRow = $objResult->fetch_array()) {
$objGrowthGroupLocation = new GrowthGroupLocation();
$objGrowthGroupLocation->Location = $objRow['location'];
$objGrowthGroupLocation->Longitude = $objRow['longitude'];
$objGrowthGroupLocation->Latitude = $objRow['latitude'];
$objGrowthGroupLocation->Zoom = $objRow['zoom'];
$objGrowthGroupLocation->Save();
$strTokens = explode('(', $objGrowthGroupLocation->Location);
$objParentGroup = Group::CreateGroupForMinistry($objMinistry, GroupType::GroupCategory, trim($strTokens[0]), 'Growth Groups in ' . $objGrowthGroupLocation->Location);
$objGroupCategory = new GroupCategory();
$objGroupCategory->Group = $objParentGroup;
示例3: transferSearch
function transferSearch()
{
//Connect to database and initialize variables
$conn = new mysqli("172.16.11.120", "auditorlook", "lookup4prop", "webdata");
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$AmountMin = $_POST['AmountMin'];
$AmountMax = $_POST['AmountMax'];
$Grantor = $_POST['Grantor'];
$Grantee = $_POST['Grantee'];
$Parcel = $_POST['Parcel'];
$City = $_POST['City'];
$Tax = $_POST['Tax'];
$Street = $_POST['Street'];
$Building = $_POST['Building'];
$Valid = $_POST['Valid'];
$DTE = $_POST['DTE'];
$ifRan = false;
if ($_POST['Year'] != null && $_POST['Month'] != null) {
$Year = $_POST['Year'] . "%' \n\t\t\t\t\tAND mtransferDate LIKE '_____" . $_POST['Month'];
} else {
if ($_POST['Year'] == null && $_POST['Month'] != null) {
$Year = $_POST['Month'];
} else {
if ($_POST['Year'] != null && $_POST['Month'] == null) {
$Year = $_POST['Year'];
} else {
if ($_POST['Year'] == null && $_POST['Month'] == null) {
$Year = null;
}
}
}
}
$querys = "SELECT ge.*, det.* FROM governmaxextract AS ge \n\t\n\tLEFT JOIN detinfo AS det \n\tON ge.mpropertyNumber = det.mpropertyNumber \t\t\n\t\n\tWHERE ge.mpropertyNumber = '{$Parcel}'";
$conn->query($querys);
$Query = 'select * from governmaxtransferhistoryextract where ';
runQuery('mtransferDate', $Year, " LIKE ", "%'");
runQuery('msalesAmount', $AmountMin, ' >= ', "'");
runQuery('msalesAmount', $AmountMax, '<=', "'");
runQuery('FromDeededOwner', $Grantor, ' LIKE ', "%'");
runQuery('ToDeededOwner', $Grantee, ' LIKE ', "%'");
runQuery('SourceParcel', $Parcel, ' = ', "'");
runQuery('mlocCity', $City, ' LIKE ', "%'");
runQuery('mcamaId', $Tax, ' LIKE ', "%'");
runQuery('mlocStrName', $Street, ' LIKE ', "%'");
runQuery('LandOnlySale', $Building, ' = ', "'");
runQuery('msaleValid', $Valid, ' = ', "'");
runQuery('UseCode', $DTE, ' = ', "'");
if ($ifRan = true) {
echo $Query;
$fQuery = $conn->Query($Query);
echo '<table border=1>';
for ($i = 0; $i <= $fQuery->num_rows; $i++) {
$result = $fQuery->fetch_array();
echo '<tr>';
echo '<td>';
echo $result['mtransferDate'] . "<br />";
echo $result['SourceParcel'];
echo '</td>';
echo '<td>';
echo $result['mconveyanceNumber'];
echo '</td>';
echo '<td>';
echo "To: " . $result['ToDeededOwner'] . "<br />";
echo "From: " . $result['FromDeededOwner'];
echo '</td>';
echo '<td>';
echo "Acres: " . $result['macres'] . "<br />";
echo "Legal: " . $result['mlegalDescription'] . "<br />";
echo "Location: " . $result['LocationAddress'];
echo '</td>';
echo '<td>';
echo 'Sale Amount: ' . $result['msalesAmount'] . '<br />';
echo 'Building: ' . $result['LandOnlySale'] . '<br />';
echo 'DTE: ' . $result['UseCode'];
echo '</td>';
echo '</tr>';
}
echo '</table>';
} else {
echo 'please enter data';
}
function runQuery($field, $fieldData, $Operator, $wildcard)
{
global $Query;
global $ifRan;
if ($fieldData != null && $ifRan == false) {
$Query = $Query . $field . $Operator . "'" . $fieldData . $wildcard;
$ifRan = true;
} else {
if ($fieldData != null && $ifRan == true) {
$Query = $Query . ' and ' . $field . $Operator . "'" . $fieldData . $wildcard;
} else {
if ($fieldData == null) {
return;
}
}
}
}
//.........这里部分代码省略.........
示例4: mysqli
<?php
ini_set('memory_limit', '1024M');
$objMySqli = new mysqli('localhost', 'root', '', 'alcf_address');
QDataGen::DisplayForEachTaskStart('Cleaning Addresses', Address::CountAll());
foreach (Address::LoadAll() as $objAddress) {
QDataGen::DisplayForEachTaskNext('Cleaning Addresses');
$strQuery = sprintf("SELECT id FROM address WHERE address_1 %s AND address_2 %s AND address_3 %s AND city %s AND state %s AND zip_code %s;", is_null($objAddress->Address1) ? 'IS NULL' : "='" . $objMySqli->escape_string($objAddress->Address1) . "'", is_null($objAddress->Address2) ? 'IS NULL' : "='" . $objMySqli->escape_string($objAddress->Address2) . "'", is_null($objAddress->Address3) ? 'IS NULL' : "='" . $objMySqli->escape_string($objAddress->Address3) . "'", is_null($objAddress->City) ? 'IS NULL' : "='" . $objMySqli->escape_string($objAddress->City) . "'", is_null($objAddress->State) ? 'IS NULL' : "='" . $objMySqli->escape_string($objAddress->State) . "'", is_null($objAddress->ZipCode) ? 'IS NULL' : "='" . $objMySqli->escape_string($objAddress->ZipCode) . "'");
$objResult = $objMySqli->Query($strQuery);
if ($objRow = $objResult->fetch_array()) {
$objResult = $objMySqli->Query('SELECT * FROM corrected_address WHERE address_id=' . $objRow['id']);
$objRow = $objResult->fetch_array();
if ($objRow['status_flag'] == 1) {
$objAddress->Address1 = $objRow['address_1'];
$objAddress->Address2 = $objRow['address_2'];
$objAddress->City = $objRow['city'];
$objAddress->State = $objRow['state'];
$objAddress->ZipCode = $objRow['zip_code'];
$objAddress->InvalidFlag = false;
$objAddress->VerificationCheckedFlag = true;
} else {
$objAddress->InvalidFlag = true;
}
$objAddress->Save();
} else {
if (!$objAddress->ValidateUsps()) {
print "NONE FOUND FOR - " . $objAddress->Id . "\r\n";
$objAddress->InvalidFlag = true;
$objAddress->Save();
}
}
示例5:
$Query = 'select * from governmaxtransferhistoryextract where ';
runQuery('mtransferDate', $Year, " LIKE ", "%'");
runQuery('msalesAmount', $AmountMin, ' >= ', "'");
runQuery('msalesAmount', $AmountMax, '<=', "'");
runQuery('FromDeededOwner', $Grantor, ' LIKE ', "%'");
runQuery('ToDeededOwner', $Grantee, ' LIKE ', "%'");
runQuery('SourceParcel', $Parcel, ' = ', "'");
runQuery('mlocCity', $City, ' LIKE ', "%'");
runQuery('mcamaId', $Tax, ' LIKE ', "%'");
runQuery('mlocStrName', $Street, ' LIKE ', "%'");
runQuery('LandOnlySale', $Building, ' = ', "'");
runQuery('msaleValid', $Valid, ' = ', "'");
runQuery('UseCode', $DTE, ' = ', "'");
if ($ifRan = true) {
echo $Query;
$fQuery = $conn->Query($Query);
echo '<table border=1>';
for ($i = 0; $i <= $fQuery->num_rows; $i++) {
$result = $fQuery->fetch_array();
echo '<tr>';
echo '<td>';
echo $result['mtransferDate'] . "<br />";
echo $result['SourceParcel'];
echo '</td>';
echo '<td>';
echo $result['mconveyanceNumber'];
echo '</td>';
echo '<td>';
echo "To: " . $result['ToDeededOwner'] . "<br />";
echo "From: " . $result['FromDeededOwner'];
echo '</td>';