This topic is locked
[SOLVED]

 Menu Summary

3/28/2011 2:48:00 PM
PHPRunner General questions
cyberjas2001 author

I have this Snippet Code for my Main Menu, which shows the Units i have in the Yard, the units that were dropped today and also the units that were picked up today, but i was just able to show the containers i have in my yard, I dont know how to get the other numbers, here's the code
date_default_timezone_set('America/New_York');

global $conn;

$mess = "";

$mess2 = "";

$mess3 = "";
$rs = db_query("select count() from container where status='Active'",$conn);

if ($data = db_fetch_numarray($rs))

$mess.= "$data[0]
";
$rs = db_query("select count(
) from container where DateIn='.date().'",$conn);

if ($data = db_fetch_numarray($rs))

$mess2.= "$data[0]
";
$rs = db_query("select count(*) from container where DateOut='.date().'",$conn);

if ($data = db_fetch_numarray($rs))

$mess3.= "$data[0]
";
echo '<table width="200" border="1">';

echo ' <tr>';

echo ' <td><b>Units in Yard</b></td>';

echo ' <td>'.$mess.'</td>';

echo ' </tr>';

echo ' <tr>';

echo ' <td><b>Units Dropped Off Today</b></td>';

echo ' <td>'.$mess2.'</td>';

echo ' </tr>';

echo ' <tr>';

echo ' <td><b>Units Picked Up Today</b></td>';

echo ' <td>'.$mess3.'</td>';

echo ' </tr>';

echo '</table>';

echo '<i> As of '.date("l, M jS, Y / H:i:s A").'</i>'
And here is the result:
COMPANY SUMMARY

Units in Yard 44
Units Dropped Off Today 0 <----- I have a problem with this one
Units Picked Up Today 0 <------- and also this one
As of Monday, Mar 28th, 2011 / 14:08:15 PM
Any help out there??? thanks!!!

J
Jane 3/29/2011

Please see my changes below:

$mess = "";

$rs = db_query("select count(*) from container where status='Active'",$conn);

if ($data = db_fetch_numarray($rs))

$mess.= "$data[0]
";
$mess2 = "";

$rs = db_query("select count(*) from container where DateIn=now()",$conn);

if ($data = db_fetch_numarray($rs))

$mess2.= "$data[0]
";
$mess3 = "";

$rs = db_query("select count(*) from container where DateOut=now()",$conn);

if ($data = db_fetch_numarray($rs))

$mess3.= "$data[0]
";
cyberjas2001 author 3/29/2011



Please see my changes below:

$mess = "";

$rs = db_query("select count(*) from container where status='Active'",$conn);

if ($data = db_fetch_numarray($rs))

$mess.= "$data[0]
";
$mess2 = "";

$rs = db_query("select count(*) from container where DateIn=now()",$conn);

if ($data = db_fetch_numarray($rs))

$mess2.= "$data[0]
";
$mess3 = "";

$rs = db_query("select count(*) from container where DateOut=now()",$conn);

if ($data = db_fetch_numarray($rs))

$mess3.= "$data[0]
";



Thanks for the changes but somehow is still showing me zero, DateIn & DateOut fields are DATETIME type, do you think this affect the result???

What I'm thinking is that is taking the whole info stored in these fields, for example (3/29/2011 09:28) instead of just comparing the dates

cyberjas2001 author 3/29/2011

I was playing a little bit and I found that if i use
DateIn >= NOW()
the result now is 2; which is right, but this is kinda wrong because that will affect tomorrow's result adding the ones for today maybe?
and also when i applied the same tactic on the
DateOut <= NOW()
Shows 3, and today just 1 container was picked up
I dont get it, because when I use "DateIn = NOW()" nothing happened

cyberjas2001 author 3/31/2011

ANY HELP???

Sergey Kornilov admin 3/31/2011

If you have a valid support contract post your application to Demo Account and open a ticket at http://support.xlinesoft.com sending your Demo Account URL. 'Demo Account' button can be found on the last screen in the program.

cyberjas2001 author 3/31/2011



If you have a valid support contract post your application to Demo Account and open a ticket at http://support.xlinesoft.com sending your Demo Account URL. 'Demo Account' button can be found on the last screen in the program.


Ok Ill do it

cyberjas2001 author 4/1/2011

I found my mistake, here's the right coding:



global $conn;

$mess = "";

$rs = db_query("select count(*) from container where status='Active'",$conn);

if ($data = db_fetch_numarray($rs))

$mess.= "$data[0]
";
$mess2 = "";

$rs = db_query("select count(*) from container where DATE(DateOut)= CURDATE()",$conn);

if ($data = db_fetch_numarray($rs))

$mess2.= "$data[0]
";
$mess3 = "";

$rs = db_query("select count(*) from container where DATE(DateIn)= CURDATE() AND status='Closed' ",$conn);

if ($data = db_fetch_numarray($rs))

$mess3.= "$data[0]
";


MY RESULTS ARE CORRECT NOW

Units in Yard 39

Units Dropped Off Today 1

Units Picked Up Today 1
Hope this works for somebody else!!!