本文整理汇总了PHP中client::query方法的典型用法代码示例。如果您正苦于以下问题:PHP client::query方法的具体用法?PHP client::query怎么用?PHP client::query使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类client
的用法示例。
在下文中一共展示了client::query方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: header
}
if ($_POST['confirm']) {
for ($J = 1; $J <= $_POST['nTrans']; $J++) {
if ($_POST['check' . $J]) {
$trans[] = $_POST['tran' . $J];
}
}
if (sizeof($trans) == 0) {
header("location: index.php?pageload=15");
}
$values = "";
for ($K = 0; $K <= sizeof($trans) - 2; $K++) {
$values .= '(' . $trans[$K] . '),';
}
$values .= '(' . $trans[sizeof($trans) - 1] . ')';
$List->query("CREATE TEMPORARY TABLE edit_values (TRANS_ID INT);");
$List->query("INSERT INTO edit_values (TRANS_ID)\r\n\t\t\tVALUES {$values};");
$List->query("UPDATE deposit, edit_values\r\n\t\t\tSET deposit.VERIFY =1\r\n\t\t\tWHERE deposit.TRANS_ID=edit_values.TRANS_ID;");
header("location: index.php?pageload=15");
}
if ($_POST['edit']) {
$_POST['editer'] = 1;
header("location: index.php?pageload=15");
}
if ($_POST['editer']) {
echo "holy shit that worked";
$template->set_filenames(array('body' => 'approval_table.html'));
$template->pparse('body');
}
if ($_POST['delete']) {
for ($J = 1; $J <= $_POST['nTrans']; $J++) {
示例2: foreach
{
$value = false;
$x = 0;
foreach ($haystack as $temp) {
$search = array_search($needle, $temp);
if (strlen($search) > 0 && $search >= 0) {
$value[0] = $x;
$value[1] = $search;
}
$x++;
}
return $value;
}
$data = array();
$List = new client();
$List->query("CREATE TEMPORARY TABLE recent_date_zone SELECT MAX( DATE ) AS max_date, CUST_ID, ZONE\r\n\t\t\t\tFROM cust_location\r\n\t\t\t\tGROUP BY CUST_ID\r\n\t\t\t\tORDER BY ZONE DESC;");
$List->query("SET @rank =0,\r\n\t\t\t\t@prev_val = 1;");
$List->query("\r\n\t\t\t\tSELECT @rank := IF( @prev_val = ZONE , @rank+1, 1 ) AS rank, @prev_val := ZONE AS ZONE, CUST_ID\r\n\t\t\t\tFROM recent_date_zone\r\n\t\t\t\tORDER BY max_date, ZONE DESC;");
while ($resultie = mysql_fetch_array($List->result)) {
if (mysql_errno()) {
die(sprintf("Cannot connect to server: %s (%d)\n", htmlspecialchars(mysql_error()), mysql_errno()));
}
$data[$resultie[ZONE]][$resultie[rank]] = 0;
}
$List->query("CREATE TEMPORARY TABLE recent_date_zone SELECT MAX( DATE ) AS max_date, CUST_ID, ZONE\r\n\t\t\t\tFROM cust_location\r\n\t\t\t\tGROUP BY CUST_ID\r\n\t\t\t\tORDER BY ZONE DESC;");
$List->query("SET @rank =0,\r\n\t\t\t\t@prev_val = 1;");
$List->query("CREATE TEMPORARY TABLE current_zone \r\n\t\t\t\tSELECT @rank := IF( @prev_val = ZONE , @rank+1, 1 ) AS rank, @prev_val := ZONE AS ZONE, CUST_ID\r\n\t\t\t\tFROM recent_date_zone\r\n\t\t\t\tORDER BY max_date, ZONE DESC;");
$List->query("CREATE TEMPORARY TABLE goal_date\r\n\t\t\t\tSELECT MAX( cust_goal.DATE ) AS max_date, cust_goal.CUST_ID, current_zone.rank, current_zone.ZONE\r\n\t\t\t\tFROM cust_goal, deposit, current_zone\r\n\t\t\t\tWHERE cust_goal.CUST_ID=deposit.CUST_ID\r\n\t\t\t\tAND cust_goal.CUST_ID=current_zone.CUST_ID\r\n\t\t\t\tGROUP BY CUST_ID;");
$List->query("SELECT SUM( deposit.AMOUNT ) AS TDEPOSIT, deposit.CUST_ID, goal_date.rank, goal_date.ZONE \r\n\t\t\t\tFROM deposit, goal_date\r\n\t\t\t\tWHERE deposit.CUST_ID = goal_date.CUST_ID\r\n\t\t\t\tGROUP BY CUST_ID;");
while ($resultie = mysql_fetch_array($List->result)) {
if (mysql_errno()) {
示例3: MAX
WHERE CLCAM_ID= 1
ORDER BY ZONE;");
$List->query("CREATE TEMPORARY TABLE dates
SELECT MAX(emp_loc.DATE) AS MXDATE, emp_loc.ZONE
FROM emp_loc, zones
WHERE emp_loc.ZONE = zones.ZONE
GROUP BY ZONE;");
$List->query("CREATE TEMPORARY TABLE most_recent_emp
SELECT emp_loc.DATE, emp_loc.EMP_ID, emp_loc.ZONE
FROM emp_loc, dates
WHERE emp_loc.DATE = dates.MXDATE
AND emp_loc.ZONE = dates.ZONE;");
$List->query("SELECT ZONE FROM most_recent_emp;");*/
/************do some code here about zone storage?*****/
//================== Queries sum transactions and total deposits
$List->query("CREATE TEMPORARY TABLE recent_date_zone \r\n\t\t\t\tSELECT MAX( DATE ) AS max_date, CUST_ID \r\n\t\t\t\tFROM cust_location\r\n\t\t\t\tGROUP BY CUST_ID;");
$List->query("CREATE TEMPORARY TABLE current_zone \r\n\t\t\t\tSELECT cust_location.CUST_ID, cust_location.ZONE\r\n\t\t\t\tFROM recent_date_zone, cust_location\r\n\t\t\t\tWHERE cust_location.DATE = recent_date_zone.max_date\r\n\t\t\t\tAND cust_location.CUST_ID=recent_date_zone.CUST_ID;");
$List->query("SELECT current_zone.ZONE, COUNT(deposit.TRANS_ID) AS TTRANS, SUM(deposit.AMOUNT) AS TDEPOSIT\r\n\t\t\t\tFROM deposit, current_zone\r\n\t\t\t\tWHERE deposit.DATE > CURDATE( )\r\n\t\t\t\tAND deposit.CUST_ID = current_zone.CUST_ID\r\n\t\t\t\tGROUP BY current_zone.ZONE;");
while ($resultie = mysql_fetch_array($List->result)) {
if (mysql_errno()) {
die(sprintf("Cannot connect to server: %s (%d)\n", htmlspecialchars(mysql_error()), mysql_errno()));
}
$template->assign_block_vars('deposit', array('SWITCH' => $switch, 'ZONE' => $resultie['ZONE'], 'TRANSACTION' => $resultie['TTRANS'], 'DEPOSIT' => $resultie['TDEPOSIT']));
}
$List->query("SELECT current_zone.ZONE, COUNT(withdraw.TRANS_ID) AS TTRANS, SUM(withdraw.AMOUNT) AS TWITH\r\n\t\t\t\tFROM withdraw, current_zone\r\n\t\t\t\tWHERE withdraw.DATE > CURDATE( )\r\n\t\t\t\tAND withdraw.CUST_ID = current_zone.CUST_ID\r\n\t\t\t\tGROUP BY current_zone.ZONE;\t");
while ($resultie = mysql_fetch_array($List->result)) {
if (mysql_errno()) {
die(sprintf("Cannot connect to server: %s (%d)\n", htmlspecialchars(mysql_error()), mysql_errno()));
}
$template->assign_block_vars('withdraw', array('SWITCH' => $switch, 'ZONE' => $resultie['ZONE'], 'TRANSACTION' => $resultie['TTRANS'], 'TWITH' => $resultie['TWITH']));
}
示例4: foreach
{
$value = false;
$x = 0;
foreach ($haystack as $temp) {
$search = array_search($needle, $temp);
if (strlen($search) > 0 && $search >= 0) {
$value[0] = $x;
$value[1] = $search;
}
$x++;
}
return $value;
}
$data = array();
$List = new client();
$List->query("CREATE TEMPORARY TABLE recent_date_zone \r\n\t\t\t\tSELECT MAX( DATE ) AS max_date, CUST_ID \r\n\t\t\t\tFROM cust_location\r\n\t\t\t\tGROUP BY CUST_ID;");
$List->query("CREATE TEMPORARY TABLE current_zone \r\n\t\t\t\tSELECT cust_location.CUST_ID, cust_location.ZONE\r\n\t\t\t\tFROM recent_date_zone, cust_location\r\n\t\t\t\tWHERE cust_location.DATE = recent_date_zone.max_date\r\n\t\t\t\tAND cust_location.CUST_ID=recent_date_zone.CUST_ID\r\n\t\t\t\tAND ZONE = {$_GET['zone']};");
$List->query("CREATE TEMPORARY TABLE recent_date_goal\r\n\t\t\t\tSELECT MAX( cust_goal.DATE ) AS max_date, cust_goal.CUST_ID\r\n\t\t\t\tFROM cust_goal, current_zone\r\n\t\t\t\tWHERE cust_goal.CUST_ID=current_zone.CUST_ID\r\n\t\t\t\tGROUP BY CUST_ID;");
$List->query("CREATE TEMPORARY TABLE current_goal\r\n\t\t\t\tSELECT cust_goal.CUST_ID, cust_goal.GOAL, account.DESCR\r\n\t\t\t\tFROM cust_goal, recent_date_goal, account\r\n\t\t\t\tWHERE cust_goal.DATE=recent_date_goal.max_date\r\n\t\t\t\tAND cust_goal.CUST_ID=recent_date_goal.CUST_ID\r\n\t\t\t\tAND account.CUST_ID=recent_date_goal.CUST_ID;");
$List->query("SELECT CUST_ID\r\n\t\t\t\tFROM current_goal\r\n\t\t\t\tORDER BY CUST_ID ASC;");
while ($resultie = mysql_fetch_array($List->result)) {
if (mysql_errno()) {
die(sprintf("Cannot connect to server: %s (%d)\n", htmlspecialchars(mysql_error()), mysql_errno()));
}
$data[$resultie[CUST_ID]] = 0;
}
$List->query("SELECT CUST_ID, AMOUNT\r\n\t\t\t\tFROM deposit\r\n\t\t\t\tWHERE DATE > CURDATE( );");
while ($resultie = mysql_fetch_array($List->result)) {
if (mysql_errno()) {
die(sprintf("Cannot connect to server: %s (%d)\n", htmlspecialchars(mysql_error()), mysql_errno()));
}
示例5: array
if ($_POST['scid']) {
$cid = $test->is_cust($_POST['scid'], $_POST['szone']);
if ($cid == 0) {
$template->assign_vars(array('ERROR' => "Votre donnee n'est pas valide"));
$template->assign_block_vars('switch_cust_search', array());
if ($_SESSION['access'] > 1) {
$template->assign_block_vars('switch_cust_search.switch_zone', array());
}
$template->pparse('body');
$template->set_filenames(array('footer' => 'footer.html'));
$template->pparse('footer');
exit;
}
}
$template->assign_block_vars('switch_cust_display', array());
$List->query("CREATE TEMPORARY TABLE recent_date_zone \r\n\t\t\t\t\tSELECT MAX( DATE ) AS max_date, CUST_ID \r\n\t\t\t\t\tFROM cust_location\r\n\t\t\t\t\tWHERE CUST_ID= {$cid}\r\n\t\t\t\t\tGROUP BY CUST_ID;");
$List->query("CREATE TEMPORARY TABLE current_zone \r\n\t\t\t\t\tSELECT cust_location.CUST_ID, cust_location.ZONE\r\n\t\t\t\t\tFROM recent_date_zone, cust_location\r\n\t\t\t\t\tWHERE cust_location.DATE = recent_date_zone.max_date\r\n\t\t\t\t\tAND cust_location.CUST_ID = recent_date_zone.CUST_ID\r\n\t\t\t\t\tAND ZONE = {$_SESSION['zone']};");
$List->query("CREATE TEMPORARY TABLE recent_date_goal\r\n\t\t\t\t\tSELECT MAX( cust_goal.DATE ) AS max_date, cust_goal.CUST_ID\r\n\t\t\t\t\tFROM cust_goal, current_zone\r\n\t\t\t\t\tWHERE cust_goal.CUST_ID=current_zone.CUST_ID\r\n\t\t\t\t\tGROUP BY CUST_ID;");
$List->query("CREATE TEMPORARY TABLE current_goal\r\n\t\t\t\t\tSELECT cust_goal.CUST_ID, cust_goal.GOAL\r\n\t\t\t\t\tFROM cust_goal, recent_date_goal, account\r\n\t\t\t\t\tWHERE cust_goal.DATE=recent_date_goal.max_date\r\n\t\t\t\t\tAND cust_goal.CUST_ID=recent_date_goal.CUST_ID\r\n\t\t\t\t\tAND account.CUST_ID=recent_date_goal.CUST_ID;");
$List->query("SELECT account.CUST_ID, account.CL_ACCT, account.DESCR, account.SIGNING_EMP,\r\n\t\t\t\t\taccount.SIGNING_DATE, account.STATUS, current_goal.GOAL\r\n\t\t\t\t\tFROM account, current_goal\r\n\t\t\t\t\tWHERE account.CUST_ID = current_goal.CUST_ID;");
$List->dumpTable();
$template->assign_vars(array('CUST_ID' => $List->display[CUST_ID], 'EMP_ID' => $_SESSION['emp'], 'CL_ACCT' => $List->display[CL_ACCT], 'DESCR' => $List->display[DESCR], 'STATUS' => $List->display[STATUS], 'SIGNING_AGENT' => $List->display[SIGNING_EMP], 'SIGNING_DATE' => $List->display[SIGNING_DATE], 'CURRENT_GOAL' => $List->display[GOAL]));
//================== Finds signatories and displays them
$List->query("SELECT cust_info.CUST_ID, cust_info.FIRST_NAME, cust_info.LAST_NAME, cust_info.D_O_B, cust_info.OCCUPATION, cust_info.SEX, cust_info.UNIQUEID,\r\n\t\t\t\t\tcurrent_goal.GOAL, current_goal.CUST_ID\r\n\t\t\t\t\tFROM cust_info, current_goal\r\n\t\t\t\t\tWHERE cust_info.CUST_ID = current_goal.CUST_ID\r\n\t\t\t\t\t;");
while ($resultie = mysql_fetch_array($List->result)) {
if (mysql_errno()) {
die(sprintf("Cannot connect to server: %s (%d)\n", htmlspecialchars(mysql_error()), mysql_errno()));
}
$template->assign_block_vars('switch_cust_display.person', array('UNIQUE' => $resultie[UNIQUEID], 'FIRST_NAME' => $resultie[FIRST_NAME], 'LAST_NAME' => $resultie[LAST_NAME], 'D_O_B' => $resultie[D_O_B], 'OCCUPATION' => $resultie[OCCUPATION], 'SEX' => $resultie[SEX]));
}
if (!$resultie) {
示例6: client
<?php
include 'classes/my_customers.php';
$List = new client();
if ($_GET['pageload']) {
$template->set_filenames(array('body' => 'zone_choice.html'));
//================== Initial set of queries generates the active zones and the promoters assigned to them
$List->query("CREATE TEMPORARY TABLE zones\r\n\t\t\tSELECT DISTINCT ZONE \r\n\t\t\tFROM cust_location\r\n\t\t\tWHERE CLCAM_ID= 1\r\n\t\t\tORDER BY ZONE;");
$List->query("CREATE TEMPORARY TABLE dates\r\n\t\t\tSELECT MAX(emp_loc.DATE) AS MXDATE, emp_loc.ZONE \r\n\t\t\tFROM emp_loc, zones\r\n\t\t\tWHERE emp_loc.ZONE = zones.ZONE\r\n\t\t\tGROUP BY ZONE;");
$List->query("CREATE TEMPORARY TABLE most_recent_emp\r\n\t\t\tSELECT emp_loc.DATE, emp_loc.EMP_ID, emp_loc.ZONE\r\n\t\t\tFROM emp_loc, dates\r\n\t\t\tWHERE emp_loc.DATE = dates.MXDATE\r\n\t\t\tAND emp_loc.ZONE = dates.ZONE;");
$List->query("SELECT most_recent_emp.EMP_ID, emp_info.FIRST_NAME, emp_info.LAST_NAME, most_recent_emp.ZONE\r\n\t\t\tFROM most_recent_emp, emp_info\r\n\t\t\tWHERE emp_info.EMP_ID = most_recent_emp.EMP_ID\r\n\t\t\tORDER BY most_recent_emp.ZONE ASC;");
//===============================================================================
while ($resultie = mysql_fetch_array($List->result)) {
if (mysql_errno()) {
die(sprintf("Cannot connect to server: %s (%d)\n", htmlspecialchars(mysql_error()), mysql_errno()));
}
$contenttest = sizeof($resultie);
$template->assign_block_vars('line', array('SWITCH' => $switch, 'CUST_ID' => $resultie[EMP_ID], 'FNAME' => $resultie[FIRST_NAME], 'LNAME' => $resultie[LAST_NAME], 'ZONE' => $resultie[ZONE]));
if (isset($switch)) {
unset($switch);
} else {
$switch = 'line';
}
if (!$contenttest) {
$template->assign_block_vars('line', array('NO_RESULT' => 'No Result'));
}
}
}
$template->pparse('body');
示例7: NOW
$DESCR = $_POST['NOM'];
$SIGNING_EMP = $_POST['emp'];
$SIGNING_DATE = $_POST['date'];
$GOAL = $_POST['mise'];
$ZONE = $_POST['zone'];
if (!isset($ZONE)) {
$ZONE = $_SESSION['zone'];
}
if (is_int($CL_ACCT)) {
$label = '`CL_ACCT`, ';
$CL_ACCT .= ', ';
} else {
$label = '';
$CL_ACCT = '';
}
$List->query("INSERT INTO `account` \r\n\t\t\t\t\t\t\t\t({$label}`DESCR`, `SIGNING_EMP`, `SIGNING_DATE`, `STATUS`) \r\n\t\t\t\t\t\t\t\tVALUES\r\n\t\t\t\t\t\t\t\t({$CL_ACCT} '{$DESCR}', {$SIGNING_EMP}, NOW(), 'ACTIVE');");
$List->query("SELECT LAST_INSERT_ID({$List->conn}) AS CID FROM `account` ORDER BY CID;");
while ($resultie = mysql_fetch_array($List->result)) {
$cid = $resultie[CID];
}
$List->query("INSERT INTO `cust_goal`\r\n\t\t\t\t\t\t\t\t\t(`CUST_ID`, `DATE`, `GOAL`)\r\n\t\t\t\t\t\t\t\t\tVALUES\r\n\t\t\t\t\t\t\t\t\t({$cid}, NOW(), {$GOAL});");
$List->query("INSERT INTO `cust_location`\r\n\t\t\t\t\t\t\t\t\t(`CUST_ID`, `DATE`, `ZONE`, `CLCAM_ID`)\r\n\t\t\t\t\t\t\t\t\tVALUES\r\n\t\t\t\t\t\t\t\t\t({$cid}, NOW(), {$ZONE}, 1);");
/******************************************BUILD CLIENT IS DONE NOW DISPLAYING********************************************************/
$List->query("SELECT ZONE FROM `cust_location` WHERE CUST_ID = {$cid} ;");
while ($resultie = mysql_fetch_array($List->result)) {
$test = $resultie[ZONE];
}
echo $test;
$template->set_filenames(array('body' => 'view_client.html'));
$template->assign_block_vars('switch_cust_display', array());
$List->query("CREATE TEMPORARY TABLE recent_date_zone \r\n\t\t\t\t\t\t\tSELECT MAX( DATE ) AS max_date, CUST_ID \r\n\t\t\t\t\t\t\tFROM cust_location\r\n\t\t\t\t\t\t\tWHERE CUST_ID= {$cid}\r\n\t\t\t\t\t\t\tGROUP BY CUST_ID;");
示例8: client
<?php
if ($_POST['submit']) {
session_start();
include "class_lib.php";
include "classes/page.php";
}
include 'classes/my_customers.php';
$List = new client();
if ($_POST['submit']) {
$cid = $_POST['cid'];
$m = date(n, $_POST['date']);
$y = date(Y, $_POST['date']);
$List->query("SELECT TRANS_ID \r\n\t\t\t\t\tFROM deposit\r\n\t\t\t\t\tWHERE MONTH(DATE) = {$m}\r\n\t\t\t\t\tAND YEAR(DATE) ={$y}\r\n\t\t\t\t\tAND CUST_ID ={$cid};");
while ($resultie = mysql_fetch_array($List->result)) {
$trans[] = $resultie['TRANS_ID'];
}
if (sizeof($trans) == 0) {
//ERROR
header("location: index.php?pageload=15");
}
$values = "";
for ($K = 0; $K <= sizeof($trans) - 2; $K++) {
$values .= '(' . $trans[$K] . '),';
}
$values .= '(' . $trans[sizeof($trans) - 1] . ')';
$List->query("INSERT INTO withdraw \r\n\t\t\t\t\t(`CUST_ID`,`AMOUNT`,`PERIOD`,`EMP_ID`,`CLCAM_ID`,`CHECK`)\r\n\t\t\t\t\tVALUES \r\n\t\t\t\t\t({$cid},{$_POST['NET']},'{$y}-{$m}-0',{$_SESSION['emp']},1, {$_POST['check']});");
$List->query("CREATE TEMPORARY TABLE edit_values (TRANS_ID INT);");
$List->query("INSERT INTO edit_values (TRANS_ID)\r\n\t\t\t\t\tVALUES {$values};");
$List->query("UPDATE deposit, edit_values\r\n\t\t\t\t\tSET deposit.STATUS =1\r\n\t\t\t\t\tWHERE deposit.TRANS_ID=edit_values.TRANS_ID;");
//Finished
示例9: NOW
$ZONE = $_POST['zone'];
$PASS = md5($_POST['pass1']);
if (!empty($_POST['pass1'])) {
$PASSV = ", '{$PASS}'";
$PASSF = ',`PASS`';
} else {
$PASSV = '';
$PASSF = '';
}
if (!empty($_POST['uid'])) {
if (!empty($_POST['pass1'])) {
$PASSV = ", `PASS`= '{$PASS}'";
} else {
$PASSV = '';
}
$List->query("UPDATE `emp_info` SET `LAST_NAME` = '{$LAST_NAME}',\r\n\t\t\t\t\t\t\t\t\t`FIRST_NAME` = '{$FIRST_NAME}',`USER_ID` = '{$USER_ID}',\r\n\t\t\t\t\t\t\t\t\t`HIRE_DATE` = '{$HIRE_DATE}',`ACCESS` = '{$ACCESS}' {$PASSV}\r\n\t\t\t\t\t\t\t\t\tWHERE EMP_ID = '{$_POST['uid']}';");
$emp = $_POST['uid'];
} else {
if (!empty($_POST['pass1'])) {
$PASSV = ", '{$PASS}'";
$PASSF = ',`PASS`';
} else {
$PASSV = '';
$PASSF = '';
}
$List->query("INSERT INTO `emp_info` \r\n\t\t\t\t\t\t\t\t(`LAST_NAME`, `FIRST_NAME`, `USER_ID`, `HIRE_DATE`, `ACCESS` {$PASSF}) \r\n\t\t\t\t\t\t\t\tVALUES\r\n\t\t\t\t\t\t\t\t('{$LAST_NAME}', '{$FIRST_NAME}', '{$USER_ID}', NOW(), {$ACCESS} {$PASSV});");
$List->query("SELECT LAST_INSERT_ID({$List->conn}) AS EMP FROM `emp_info` ORDER BY EMP;");
while ($resultie = mysql_fetch_array($List->result)) {
$emp = $resultie[EMP];
}
}