本文整理汇总了PHP中convertStringToDate函数的典型用法代码示例。如果您正苦于以下问题:PHP convertStringToDate函数的具体用法?PHP convertStringToDate怎么用?PHP convertStringToDate使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了convertStringToDate函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
function __construct($orientation, $metric, $size, $datefrom)
{
$dynamicY = 0;
$this->dateFrom = $datefrom;
start_db();
parent::__construct($orientation, $metric, $size);
$this->SetAutoPageBreak(true, 30);
$this->AddPage();
try {
$startdate = convertStringToDate($this->dateFrom);
$sql = "SELECT A.name, C.amount,\n\t\t\t\t\t (\n\t\t\t\t\t \t\tSELECT SUM(B.amount) * D.retailprice\n\t\t\t\t\t \t\tFROM {$_SESSION['DB_PREFIX']}eventtransaction B \n\t\t\t\t\t \t\tINNER JOIN {$_SESSION['DB_PREFIX']}product D\n\t\t\t\t\t \t\tON D.id = B.productid \n\t\t\t\t\t \t\tWHERE B.eventid = A.id \n\t\t\t\t\t \t\tAND B.eventdate = '{$startdate}' \n\t\t\t\t\t \t\tAND B.type = 'S'\n\t\t\t\t\t ) AS sold\n\t\t\t\t\t FROM {$_SESSION['DB_PREFIX']}event A \n\t\t\t\t\t LEFT OUTER JOIN {$_SESSION['DB_PREFIX']}eventforecast C\n\t\t\t\t\t ON C.eventid = A.id\n\t\t\t\t\t AND C.forecastdate = '{$startdate}' \n\t\t\t\t\t\tORDER BY A.name";
$result = mysql_query($sql);
if ($result) {
while ($member = mysql_fetch_assoc($result)) {
$sold = $member['sold'] != "" ? $member['sold'] : 0;
$line = array("Event" => $member['name'], "Takings" => "£ " . number_format($sold, 2), "Expected" => "£ " . number_format($member['amount'], 2));
$this->addLine($this->GetY(), $line, 6.2);
}
} else {
logError($sql . " - " . mysql_error());
}
} catch (Exception $e) {
logError($e->getMessage());
}
}
示例2: notifyCleaner
public function notifyCleaner($id)
{
$sql = "SELECT A.name AS clientname\n\t\t\t\t\tFROM {$_SESSION['DB_PREFIX']}client A\n\t\t\t\t\tWHERE id = " . $this->clientid;
$result = mysql_query($sql);
if ($result) {
while ($member = mysql_fetch_assoc($result)) {
$memberid = $_POST['memberid'];
$enddate = convertStringToDate($_POST['canceldate']);
if ($enddate == "") {
$enddate = "0000-00-00";
}
if ($this->weekday != $_POST['weekday'] || $this->staffid != $_POST['memberid']) {
// logError("WEEK DAY OR STAFF CHANGED", false);
$clientname = $member['clientname'];
$lines = "Shift allocated to you on " . $this->getWeekDay($_POST['weekday']) . " " . $_POST['starttime'] . "-" . $_POST['endtime'] . " for {$clientname}\n";
sendUserMessage($memberid, "Work Allocation", $lines);
}
if ($this->weekday != $_POST['weekday']) {
// logError("WEEK DAY CHANGED", false);
$sql = "DELETE FROM {$_SESSION['DB_PREFIX']}diary \n\t\t \t\t\t\t\tWHERE scheduleid = {$id}\n\t\t \t\t\t\t\tAND status = 'U'\n\t\t \t\t\t\t\tAND deleted != 'Y'";
$itemresult = mysql_query($sql);
if (!$itemresult) {
logError($sql . " - " . mysql_error());
}
} else {
if ($this->staffid != $_POST['memberid']) {
// logError("STAFF CHANGED", false);
$sql = "UPDATE {$_SESSION['DB_PREFIX']}diary \n\t\t\t\t\t\t\t\tSET memberid = {$memberid}\n\t\t \t\t\t\t\tWHERE scheduleid = {$id}\n\t\t \t\t\t\t\tAND status = 'U'\n\t\t \t\t\t\t\tAND deleted != 'Y'";
$itemresult = mysql_query($sql);
if (!$itemresult) {
logError($sql . " - " . mysql_error());
}
}
}
if ($this->enddate != $enddate) {
// logError("END DATE CHANGED: $enddate" . " - " . $this->enddate, false);
$sql = "DELETE FROM {$_SESSION['DB_PREFIX']}diary \n\t\t \t\t\t\t\tWHERE scheduleid = {$id}\n\t\t \t\t\t\t\tAND starttime > '{$enddate}'\n\t\t \t\t\t\t\tAND status = 'U'\n\t\t \t\t\t\t\tAND deleted != 'Y'";
$itemresult = mysql_query($sql);
if (!$itemresult) {
logError($sql . " - " . mysql_error());
}
}
if ($this->starttime != $_POST['starttime'] || $this->endtime != $_POST['endtime']) {
$starttime = $_POST['starttime'];
$endtime = $_POST['endtime'];
// logError("STAFF CHANGED", false);
$sql = "UPDATE {$_SESSION['DB_PREFIX']}diary \n\t\t\t\t\t\t\t\tSET starttime = '{$starttime}',\n\t\t\t\t\t\t\t\tendtime = '{$endtime}'\n\t\t \t\t\t\t\tWHERE scheduleid = {$id}\n\t\t \t\t\t\t\tAND status = 'U'\n\t\t \t\t\t\t\tAND deleted != 'Y'";
$itemresult = mysql_query($sql);
if (!$itemresult) {
logError($sql . " - " . mysql_error());
}
}
}
}
}
示例3: __construct
function __construct($orientation, $metric, $size)
{
$dynamicY = 0;
parent::__construct($orientation, $metric, $size);
$this->SetAutoPageBreak(true, 30);
$this->AddPage();
try {
$startdate = convertStringToDate($_POST['datefrom']);
$enddate = convertStringToDate($_POST['dateto']);
if ($_POST['eventid'] != "0") {
$eventid = $_POST['eventid'];
$sql = "SELECT A.name, A.retailprice,\n\t\t\t\t\t\t (SELECT SUM(B.amount) FROM {$_SESSION['DB_PREFIX']}eventtransaction B WHERE B.productid = A.id AND B.eventid = {$eventid} AND B.eventdate BETWEEN '{$startdate}' AND '{$enddate}') AS sold,\n\t\t\t\t\t\t (SELECT SUM(C.amount) FROM {$_SESSION['DB_PREFIX']}eventtransaction C WHERE C.productid = A.id AND C.eventid = {$eventid} AND C.eventdate BETWEEN '{$startdate}' AND '{$enddate}') AS broken,\n\t\t\t\t\t\t (SELECT SUM(D.amount) FROM {$_SESSION['DB_PREFIX']}eventtransaction D WHERE D.productid = A.id AND D.eventid = {$eventid} AND D.eventdate BETWEEN '{$startdate}' AND '{$enddate}') AS demo\n\t\t\t\t\t\t FROM {$_SESSION['DB_PREFIX']}product A \n\t\t\t\t\t\t\tGROUP BY A.name\n\t\t\t\t\t\t\tORDER BY A.name";
} else {
$sql = "SELECT A.name, A.retailprice,\n\t\t\t\t\t\t (SELECT SUM(B.amount) FROM {$_SESSION['DB_PREFIX']}eventtransaction B WHERE B.productid = A.id AND B.eventdate BETWEEN '{$startdate}' AND '{$enddate}' and B.type = 'S') AS sold,\n\t\t\t\t\t\t (SELECT SUM(C.amount) FROM {$_SESSION['DB_PREFIX']}eventtransaction C WHERE C.productid = A.id AND C.eventdate BETWEEN '{$startdate}' AND '{$enddate}' and C.type = 'B') AS broken,\n\t\t\t\t\t\t (SELECT SUM(D.amount) FROM {$_SESSION['DB_PREFIX']}eventtransaction D WHERE D.productid = A.id AND D.eventdate BETWEEN '{$startdate}' AND '{$enddate}' and D.type = 'G') AS demo\n\t\t\t\t\t\t FROM {$_SESSION['DB_PREFIX']}product A \n\t\t\t\t\t\t\tGROUP BY A.name\n\t\t\t\t\t\t\tORDER BY A.name";
}
$result = mysql_query($sql);
if ($result) {
$total = 0;
$totalsold = 0;
$totalbroken = 0;
$totaldemo = 0;
while ($member = mysql_fetch_assoc($result)) {
$sold = $member['sold'] != "" ? $member['sold'] : 0;
$broken = $member['broken'] != "" ? $member['broken'] : 0;
$demo = $member['demo'] != "" ? $member['demo'] : 0;
$line = array("Product" => $member['name'], "Sold" => " " . $sold, "Broken" => " " . $broken, "Demo" => " " . $demo, "Cost" => "£ " . number_format($member['retailprice'] * ($broken + $sold + $demo), 2));
$this->addLine($this->GetY(), $line);
$total += $member['retailprice'] * ($broken + $sold + $demo);
$totalsold += $sold;
$totalbroken += $broken;
$totaldemo += $demo;
}
$line = array("Product" => "Total : ", "Sold" => " " . $totalsold, "Broken" => " " . $totalbroken, "Demo" => " " . $totaldemo, "Cost" => "£ " . number_format($total, 2));
$this->addLine($this->GetY() + 4, $line);
} else {
logError($sql . " - " . mysql_error());
}
} catch (Exception $e) {
logError($e->getMessage());
}
}
示例4: COUNT
$and = "";
if ($startdate != "") {
$and .= " AND A.matchdate >= '{$startdate}' ";
}
if ($enddate != "") {
$and .= " AND A.matchdate <= '{$enddate}' ";
}
if ($userid != "0") {
$and .= " AND A.refereeid = {$userid} ";
}
$sql = "SELECT COUNT(*) AS matches, SUM(refereescore) AS score, \n\t\t\t\t\t B.name AS refereeename\n\t\t\t\t\t\tFROM {$_SESSION['DB_PREFIX']}matchdetails A \n\t\t\t\t\t\tLEFT OUTER JOIN {$_SESSION['DB_PREFIX']}referee B \n\t\t\t\t\t\tON B.id = A.refereeid \n\t\t\t\t\t\tWHERE refereescore >= 0 {$and}\n\t\t\t\t\t\tGROUP BY B.name \n\t\t\t\t\t\tORDER BY B.name";
$result = mysql_query($sql);
if ($result) {
while ($member = mysql_fetch_assoc($result)) {
$line = array("Referee" => $member['refereeename'], "Games" => $member['matches'], "Average Score" => number_format($member['score'] / $member['matches'], 1));
if ($this->GetY() > 265) {
$this->AddPage();
}
$this->addLine($this->GetY(), $line);
}
} else {
logError($sql . " - " . mysql_error());
}
} catch (Exception $e) {
logError($e->getMessage());
}
}
}
start_db();
$pdf = new RefereeReport('P', 'mm', 'A4', convertStringToDate($_POST['datefrom']), convertStringToDate($_POST['dateto']), $_POST['refereeid']);
$pdf->Output();
示例5: start_db
<?php
//Include database connection details
require_once 'system-db.php';
require_once "sqlprocesstoarray.php";
start_db();
$caseid = $_POST['caseid'];
$quotenumber = strtoupper(mysql_escape_string($_POST['quotenumber']));
$paymentnumber = mysql_escape_string($_POST['paymentnumber']);
$description = mysql_escape_string($_POST['description']);
$shippinghandling = $_POST['shippinghandling'];
$paymentdate = convertStringToDate($_POST['paymentdate']);
$quotedate = convertStringToDate($_POST['quotedate']);
$total = $_POST['total'];
$paid = $_POST['paid'];
$toaddress = mysql_escape_string($_POST['toaddress']);
$deladdress = mysql_escape_string($_POST['deladdress']);
$ourref = mysql_escape_string($_POST['ourref']);
$yourref = mysql_escape_string($_POST['yourref']);
$termsid = $_POST['termsid'];
$contactid = $_POST['contactid'];
$officeid = $_POST['officeid'];
$depositamount = $_POST['depositamount'];
$na = $_POST['na'];
$qry = "INSERT INTO {$_SESSION['DB_PREFIX']}quotes " . "(caseid, quotenumber, paymentnumber, paid, shippinghandling, paymentdate, total, " . "toaddress, deladdress, termsid, contactid, createddate, officeid, ourref, yourref, depositrequired," . "description, na, metacreateddate, metacreateduserid, metamodifieddate, metamodifieduserid) " . "VALUES " . "({$caseid}, '{$quotenumber}', '{$paymentnumber}', '{$paid}', {$shippinghandling}, '{$paymentdate}', {$total}, " . "'{$toaddress}', '{$deladdress}', '{$termsid}', {$contactid}, '{$quotedate}', {$officeid}, '{$ourref}', '{$yourref}', {$depositamount}," . "'{$description}', '{$na}', NOW(), " . getLoggedOnMemberID() . ", NOW(), " . getLoggedOnMemberID() . ")";
$result = mysql_query($qry);
if (!$result) {
if (mysql_errno() == 1062) {
$qry = "UPDATE {$_SESSION['DB_PREFIX']}quotes SET " . "quotenumber = '{$quotenumber}', " . "paymentnumber = '{$paymentnumber}', " . "ourref = '{$ourref}', " . "yourref = '{$yourref}', " . "shippinghandling = '{$shippinghandling}', " . "paymentdate = '{$paymentdate}', " . "depositrequired = {$depositamount}, " . "createddate = '{$quotedate}', " . "paid = '{$paid}', " . "total = {$total}, " . "toaddress = '{$toaddress}', " . "description = '{$description}', " . "deladdress = '{$deladdress}', " . "na = '{$na}', " . "termsid = {$termsid}, " . "contactid = {$contactid}, " . "officeid = {$officeid}, metamodifieddate = NOW(), metamodifieduserid = " . getLoggedOnMemberID() . " " . "WHERE caseid = {$caseid}";
$result = mysql_query($qry);
if (!$result) {
示例6: start_db
<?php
require_once "system-db.php";
require_once 'signature-to-image.php';
require_once 'matchcardreport.php';
start_db();
$matchdate = convertStringToDate($_POST['matchdate']);
$leaguecup = $_POST['leaguecup'];
$agegroupid = $_POST['agegroupid'];
$opposition = $_POST['oppositionid_lazy'];
$oppositionid = $_POST['oppositionid'];
$hometeam = $_POST['hometeamid_lazy'];
$hometeamid = $_POST['hometeamid'];
$hometeamscore = $_POST['hometeamscore'];
$awayteamscore = $_POST['awayteamscore'];
$ratereferee = $_POST['ratereferee'];
$rateplayers = $_POST['rateplayers'];
$ratemanagement = $_POST['ratemanagement'];
$ratespectators = $_POST['ratespectators'];
$ratepitchsize = $_POST['ratepitchsize'];
$ratepitchcondition = $_POST['ratepitchcondition'];
$rategoalsize = $_POST['rategoalsize'];
$ratechangingrooms = $_POST['ratechangingrooms'];
$complycodes = isset($_POST['complycodes']) && $_POST['complycodes'] == "on" ? 1 : 0;
$pitchsize = isset($_POST['pitchsize']) && $_POST['pitchsize'] == "on" ? 1 : 0;
$requiredbarriers = isset($_POST['requiredbarriers']) && $_POST['requiredbarriers'] == "on" ? 1 : 0;
$opponentids = isset($_POST['opponentids']) && $_POST['opponentids'] == "on" ? 1 : 0;
$refappointedbyleague = $_POST['refappointedbyleague'];
$refereeid = $_POST['refereeid'];
$referee = mysql_escape_string($_POST['refereeid_lazy']);
$division = mysql_escape_string($_POST['division']);
示例7: array
}
}
}
}
}
}
}
}
}
}
}
}
}
}
$line = array("Date of Match" => $member['matchdate'], "Age Group" => "Under " . $member['age'], "Division" => $pdivision, "Reported By" => $member['teamname'], "Match ID" => $member['id'], "Comments" => $member['remarks']);
if ($this->GetY() > 175) {
$this->AddPage();
}
$this->addLine($this->GetY(), $line);
}
} else {
logError($sql . " - " . mysql_error());
}
} catch (Exception $e) {
logError($e->getMessage());
}
}
}
start_db();
$pdf = new RefereeReport('L', 'mm', 'A4', convertStringToDate($_POST['fromdate']), convertStringToDate($_POST['todate']));
$pdf->Output();
示例8: start_db
include 'PHPExcel.php';
include 'PHPExcel/Writer/Excel2007.php';
start_db();
header('Content-type: application/excel');
header('Content-disposition: attachment; filename="conversionstatisticsreport.xlsx');
// Create new PHPExcel object
$objPHPExcel = new PHPExcel();
// Set properties
$objPHPExcel->getProperties()->setCreator("Kevin Hilton");
$objPHPExcel->getProperties()->setLastModifiedBy("Kevin Hilton");
$objPHPExcel->getProperties()->setTitle("Conversion Statistics Report");
$objPHPExcel->getProperties()->setSubject("Conversion Statistics Report");
$objPHPExcel->getProperties()->setDescription("Conversion Statistics Report");
$objPHPExcel->setActiveSheetIndex(0);
$startdate = convertStringToDate($_POST['datefrom']);
$enddate = convertStringToDate($_POST['dateto']);
$userid = $_POST['userid'];
$sql = "SELECT A.*, \n\t\t B.name AS customername, B.accountnumber, \n\t\t\tDATE_FORMAT(A.metacreateddate, '%d/%m/%Y %H:%I') AS metacreateddate, \n\t\t\tDATE_FORMAT(A.converteddatetime, '%d/%m/%Y %H:%I') AS converteddatetime,\n\t\t\tTIMEDIFF(A.converteddatetime, A.metacreateddate) as diff\n\t\t\tFROM {$_SESSION['DB_PREFIX']}quotation A \n\t\t\tLEFT OUTER JOIN {$_SESSION['DB_PREFIX']}customer B \n\t\t\tON B.id = A.customerid \n\t\t\tLEFT OUTER JOIN {$_SESSION['DB_PREFIX']}members C \n\t\t\tON C.member_id = A.takenbyid \n\t\t\tWHERE A.takenbyid = {$userid} \n\t\t\tAND A.metacreateddate >= '{$startdate}' \n\t\t\tAND A.metacreateddate <= '{$enddate}' \n\t\t\tORDER BY A.metacreateddate DESC";
$result = mysql_query($sql);
if (!$result) {
die($sql . " - " . mysql_error());
}
$row = 1;
$objPHPExcel->getDefaultStyle()->getFont()->setName('Arial')->setSize(8);
$headerArray = array('font' => array('bold' => true), 'borders' => array('allborders' => array('style' => PHPExcel_Style_Border::BORDER_THIN)));
$styleArray = array('borders' => array('allborders' => array('style' => PHPExcel_Style_Border::BORDER_THIN)));
$objPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth(72);
$objPHPExcel->getActiveSheet()->getColumnDimension('B')->setWidth(35);
$objPHPExcel->getActiveSheet()->getColumnDimension('C')->setWidth(39);
$objPHPExcel->getActiveSheet()->getColumnDimension('D')->setWidth(37);
$objPHPExcel->getActiveSheet()->getColumnDimension('E')->setWidth(37);
示例9: start_db
<?php
require_once "system-db.php";
start_db();
$id = $_POST['id'];
$clientid = $_POST['clientid'];
$memberid = $_POST['memberid'];
$startdate = convertStringToDate($_POST['startdate']) . " " . $_POST['starttime'];
$enddate = convertStringToDate($_POST['enddate']) . " " . $_POST['endtime'];
$status = $_POST['status'];
if ($status == "U") {
$sql = "SELECT DATE_FORMAT(A.starttime, '%d/%m/%Y %H:%i') AS starttime, A.memberid,\n\t\t\t\tB.name AS clientname, C.name AS originalclientname\n\t\t\t\tFROM {$_SESSION['DB_PREFIX']}diary A\n\t\t\t\tINNER JOIN {$_SESSION['DB_PREFIX']}client B\n\t\t\t\tON B.id = A.clientid\n\t\t\t\tINNER JOIN {$_SESSION['DB_PREFIX']}client C\n\t\t\t\tON C.id = {$clientid}\n\t\t\t\tWHERE id = {$id}";
$result = mysql_query($sql);
if ($result) {
while ($member = mysql_fetch_assoc($result)) {
$memberid = $member['id'];
$originaldate = $member['starttime'];
$originalclient = $member['clientname'];
$date = $_POST['startdate'];
$clientname = $_POST['originalclientname'];
sendUserMessage($memberid, "Cancellation", "The shift originally allocated on {$originaldate} for {$originalclient} has been moved to {$date} for {$clientname}");
}
}
$sql = "UPDATE {$_SESSION['DB_PREFIX']}diary SET \n\t\t\t\tstarttime = '{$startdate}', \n\t\t\t\tendtime = '{$enddate}', \n\t\t\t\tmemberid = {$memberid},\n\t\t\t\tstatus = '{$status}',\n\t\t\t\tclientid = {$clientid}\n\t\t\t\tWHERE id = {$id}";
} else {
if ($status == "I") {
$sql = "UPDATE {$_SESSION['DB_PREFIX']}diary SET \n\t\t\t\tactualstarttime = '{$startdate}', \n\t\t\t\tstatus = '{$status}',\n\t\t\t\tendtime = '{$enddate}', \n\t\t\t\tmemberid = {$memberid},\n\t\t\t\tclientid = {$clientid}\n\t\t\t\tWHERE id = {$id}";
} else {
$sql = "UPDATE {$_SESSION['DB_PREFIX']}diary SET \n\t\t\t\tactualstarttime = '{$startdate}', \n\t\t\t\tactualendtime = '{$enddate}', \n\t\t\t\tstatus = '{$status}',\n\t\t\t\tmemberid = {$memberid},\n\t\t\t\tclientid = {$clientid}\n\t\t\t\tWHERE id = {$id}";
}
}
示例10: __construct
function __construct($orientation, $metric, $size, $startdate)
{
$this->fromdate = convertStringToDate($startdate);
$this->todate = date("Y-m-d", strtotime("+1 week", strtotime($this->fromdate)));
$eventid = $_POST['eventid'];
$dynamicY = 0;
parent::__construct($orientation, $metric, $size);
$this->SetAutoPageBreak(true, 30);
$this->AddPage();
try {
$total = array();
$total[0] = 0;
$total[1] = 0;
$total[2] = 0;
$total[3] = 0;
$total[4] = 0;
$total[5] = 0;
$total[6] = 0;
$sql = "SELECT A.id, A.name \n\t\t\t\t\t\tFROM {$_SESSION['DB_PREFIX']}product A \n\t\t\t\t\t\tORDER BY A.name";
$result = mysql_query($sql);
if ($result) {
while ($member = mysql_fetch_assoc($result)) {
$productid = $member['id'];
$productname = $member['name'];
$date = $this->fromdate;
$amounts = array();
while (strtotime($date) <= strtotime($this->todate)) {
if ($eventid == 0) {
$sql = "SELECT IFNULL(SUM(B.amount), 0) AS amount\n\t\t\t\t\t\t\t\t\t\tFROM {$_SESSION['DB_PREFIX']}eventtransaction B \n\t\t\t\t\t\t\t\t\t\tWHERE B.productid = {$productid} \n\t\t\t\t\t\t\t\t\t\tAND B.eventdate = '{$date}'";
} else {
$sql = "SELECT IFNULL(SUM(B.amount), 0) AS amount\n\t\t\t\t\t\t\t\t\t\tFROM {$_SESSION['DB_PREFIX']}eventtransaction B \n\t\t\t\t\t\t\t\t\t\tWHERE B.productid = {$productid} \n\t\t\t\t\t\t\t\t\t\tAND B.eventid = {$eventid}\n\t\t\t\t\t\t\t\t\t\tAND B.eventdate = '{$date}'";
}
$itemresult = mysql_query($sql);
if ($itemresult) {
while ($itemmember = mysql_fetch_assoc($itemresult)) {
array_push($amounts, $itemmember['amount']);
}
} else {
logError($sql . " - " . mysql_error());
}
$date = date("Y-m-d", strtotime("+1 day", strtotime($date)));
}
$total[0] += $amounts[0];
$total[1] += $amounts[1];
$total[2] += $amounts[2];
$total[3] += $amounts[3];
$total[4] += $amounts[4];
$total[5] += $amounts[5];
$total[6] += $amounts[6];
$line = array(GetEventName($_POST['eventid']) => $productname, $this->dates[0] => $amounts[0], $this->dates[1] => $amounts[1], $this->dates[2] => $amounts[2], $this->dates[3] => $amounts[3], $this->dates[4] => $amounts[4], $this->dates[5] => $amounts[5], $this->dates[6] => $amounts[6]);
$this->addLine($this->GetY(), $line, 5);
}
} else {
logError($sql . " - " . mysql_error());
}
$line = array(GetEventName($_POST['eventid']) => "Total", $this->dates[0] => " " . $total[0], $this->dates[1] => " " . $total[1], $this->dates[2] => " " . $total[2], $this->dates[3] => " " . $total[3], $this->dates[4] => " " . $total[4], $this->dates[5] => " " . $total[5], $this->dates[6] => " " . $total[6]);
$this->addLine($this->GetY() + 2, $line, 5);
} catch (Exception $e) {
logError($e->getMessage());
}
}
示例11: mysql_query
$dynamicY = 0;
parent::__construct($orientation, $metric, $size);
$this->SetAutoPageBreak(true, 30);
$this->AddPage();
try {
$sql = "SELECT A.*, \n\t\t\t\t\t B.name AS customername, B.accountnumber, \n\t\t\t\t\t\tDATE_FORMAT(A.metacreateddate, '%d/%m/%Y %H:%I') AS metacreateddate, \n\t\t\t\t\t\tDATE_FORMAT(A.converteddatetime, '%d/%m/%Y %H:%I') AS converteddatetime,\n\t\t\t\t\t\tTIMEDIFF(A.converteddatetime, A.metacreateddate) as diff\n\t\t\t\t\t\tFROM {$_SESSION['DB_PREFIX']}quotation A \n\t\t\t\t\t\tLEFT OUTER JOIN {$_SESSION['DB_PREFIX']}customer B \n\t\t\t\t\t\tON B.id = A.customerid \n\t\t\t\t\t\tLEFT OUTER JOIN {$_SESSION['DB_PREFIX']}members C \n\t\t\t\t\t\tON C.member_id = A.takenbyid \n\t\t\t\t\t\tWHERE A.takenbyid = {$userid} \n\t\t\t\t\t\tAND A.metacreateddate >= '{$startdate}' \n\t\t\t\t\t\tAND A.metacreateddate <= '{$enddate}' \n\t\t\t\t\t\tORDER BY A.metacreateddate DESC";
$result = mysql_query($sql);
if ($result) {
while ($member = mysql_fetch_assoc($result)) {
$diff = $member['diff'];
$conversiondate = $member['converteddatetime'];
if (substr($diff, 0, 1) == "-") {
$diff = " ";
}
if (substr($conversiondate, 0, 2) == "00") {
$conversiondate = " ";
}
$line = array("Customer" => $member['customername'], "Customer Code" => $member['accountnumber'], "Quotation Number" => getSiteConfigData()->bookingprefix . "-" . sprintf("%06d", $member['id']), "Quotation Date" => $member['metacreateddate'], "Conversion Date" => $conversiondate, "Time Taken" => $diff, "Total" => number_format($member['total'], 2));
$this->addLine($this->GetY(), $line);
}
} else {
logError($sql . " - " . mysql_error());
}
} catch (Exception $e) {
logError($e->getMessage());
}
}
}
start_db();
$pdf = new LeadsCallbackReport('L', 'mm', 'A4', convertStringToDate($_POST['datefrom']), convertStringToDate($_POST['dateto']), $_POST['userid']);
$pdf->Output();
示例12: start_db
<?php
//Include database connection details
require_once 'system-db.php';
require_once "sqlprocesstoarray.php";
start_db();
$userid = $_POST['userid'];
$rotaid = $_POST['rotaid'];
$startdate = convertStringToDate($_POST['startdate']);
$enddate = convertStringToDate($_POST['enddate']);
$notes = mysql_escape_string($_POST['notes']);
$watch = mysql_escape_string($_POST['watch']);
if ($_POST['eventid'] == "") {
$qry = "INSERT INTO {$_SESSION['DB_PREFIX']}scheduleitem \n\t\t\t\t(\n\t\t\t\t\trotaid, userid, startdate, enddate, notes, watch\n\t\t\t\t)\n\t\t\t\tVALUES\n\t\t\t\t(\n\t\t\t\t\t{$rotaid}, {$userid}, '{$startdate}', '{$enddate}', '{$notes}', '{$watch}'\n\t\t\t\t)";
$result = mysql_query($qry);
if (!$result) {
logError($qry . " - " . mysql_error());
}
$id = mysql_insert_id();
} else {
$id = $_POST['eventid'];
$qry = "UPDATE {$_SESSION['DB_PREFIX']}scheduleitem SET \n\t\t\t\tstartdate = '{$startdate}',\n\t\t\t\tenddate = '{$enddate}',\n\t\t\t\tuserid = {$userid},\n\t\t\t\tnotes = '{$notes}',\n\t\t\t\twatch = '{$watch}'\n\t\t\t\tWHERE id = {$id}";
$result = mysql_query($qry);
if (!$result) {
logError($qry . " - " . mysql_error());
}
}
$sql = "SELECT A.*, B.fullname\n\t\t\tFROM {$_SESSION['DB_PREFIX']}scheduleitem A\n\t\t\tINNER JOIN {$_SESSION['DB_PREFIX']}members B\n\t\t\tON B.member_id = A.userid\n\t\t\tWHERE A.id = {$id}";
$json = new SQLProcessToArray();
echo json_encode($json->fetch($sql));
示例13: array
}
}
}
}
}
}
}
}
}
}
}
}
}
}
$line = array("Age Group" => "Under " . $member['age'], "Division" => $pdivision, "Home Team" => $member['hometeam'], "Score" => $member['hometeamscore'], "Away Team" => $member['opposition'], " Score " => $member['awayteamscore']);
if ($this->GetY() > 265) {
$this->AddPage();
}
$this->addLine($this->GetY(), $line);
}
} else {
logError($sql . " - " . mysql_error());
}
} catch (Exception $e) {
logError($e->getMessage());
}
}
}
start_db();
$pdf = new MatchResultReport('P', 'mm', 'A4', convertStringToDate($_POST['datefrom']), convertStringToDate($_POST['dateto']));
$pdf->Output();
示例14: mysqli_real_escape_string
<?php
require_once 'libs/dbconnect.php';
require_once 'libs/common_functions.php';
$userId = mysqli_real_escape_string($conn, $_POST['userId']);
$username = mysqli_real_escape_string($conn, $_POST['username']);
$password = mysqli_real_escape_string($conn, $_POST['password']);
$firstname = mysqli_real_escape_string($conn, $_POST['firstname']);
$lastname = mysqli_real_escape_string($conn, $_POST['lastname']);
$middlename = mysqli_real_escape_string($conn, $_POST['middlename']);
$address = mysqli_real_escape_string($conn, $_POST['address']);
$contactNo = mysqli_real_escape_string($conn, $_POST['contactNo']);
$birthday = mysqli_real_escape_string($conn, $_POST['birthday']);
$gender = mysqli_real_escape_string($conn, $_POST['gender']);
$role_type = mysqli_real_escape_string($conn, $_POST['roleType']);
$dateBirth = convertStringToDate($birthday);
$userId = empty($userId) ? -1 : $userId;
$sqlCallProcedure = "CALL pAddOrUpdateUser({$userId}, '{$username}', '{$password}', '{$firstname}', '{$lastname}', '{$middlename}', '{$contactNo}', '{$address}', {$dateBirth}, '{$gender}', '{$role_type}')";
mysqli_query($conn, $sqlCallProcedure);
$errNo = mysqli_errno($conn);
$errMSg = mysqli_error($conn);
if (0 < $errNo) {
if ($errNo == 1062) {
header('HTTP/1.0 500 Unable to add existing user.');
} else {
header('HTTP/1.0 500 DB Error (' . $errNo . ': ' . $errMSg . ').');
}
exit(0);
} else {
if (0 < $userId) {
echo "Successfully updated user!";
示例15: mysqli_real_escape_string
<?php
require_once 'libs/dbconnect.php';
require_once 'libs/common_functions.php';
$start_date = mysqli_real_escape_string($conn, $_GET['start_date']);
$dateStart = convertStringToDate($start_date);
$end_date = mysqli_real_escape_string($conn, $_GET['end_date']);
$dateEnd = convertStringToDate($end_date);
$sqlTotal = " SELECT SUM(total_sales) AS total_sales FROM vw_workout_sales_total ";
if ('null' != $dateStart && 'null' != $dateEnd) {
$sqlTotal .= " WHERE workout_date between {$dateStart} and {$dateEnd}";
} else {
$sqlTotal .= " WHERE workout_date BETWEEN date(SUBDATE(NOW(), WEEKDAY(NOW()))) and DATE(NOW() + INTERVAL (6 - WEEKDAY(NOW())) DAY) ";
}
//echo $sqlTotal;
if ($rsTotal = mysqli_query($conn, $sqlTotal) or die("Query fail: " . $sqlTotal)) {
$data = mysqli_fetch_all($rsTotal, MYSQLI_ASSOC);
header('Content-Type: application/json');
echo json_encode($data);
}
exit(0);