Page 1 of 1

First record getting dropped

Posted: Tue Feb 15, 2005 2:37 pm
by praxedis
The first record in my statement is getting dropped. Anyone have any ideas. I'm tired of looking at this code. I've included the variables just because I'm exhausted with it.

$sy = "2004";
$sm = "09";
$sd = "29";

$ey = "2005";
$em = "02";
$ed = "14";

$result = mysql_query ("Select * from orders WHERE DATE_FORMAT(nowtime, '%Y-%m-%d') BETWEEN DATE_FORMAT('$sy-$sm-$sd', '%Y-%m-%d') AND DATE_FORMAT('$ey-$em-$ed', '%Y-%m-%d')", $ilogin_db);

Search

Posted: Tue Feb 15, 2005 2:39 pm
by praxedis
And if anyone has any suggestions on how I can pass the variables through a form so that I can search by date range, it would be much appreciated.

Thanks.

Posted: Tue Feb 15, 2005 2:43 pm
by feyd
the first record where? post more code please.

okey doke

Posted: Tue Feb 15, 2005 2:47 pm
by praxedis
Check below. My problem is that there is a record dated 2004-09-29 that isn't showing up in the recordset.

Code: Select all

if ("$action" == "admin")
{
$sy = "2004";
$sm = "09";
$sd = "28";

$ey = "2005";
$em = "02";
$ed = "14";

$result = mysql_query ("Select * from orders WHERE DATE_FORMAT(nowtime, '%Y-%m-%d') BETWEEN DATE_FORMAT('$sy-$sm-$sd', '%Y-%m-%d') AND DATE_FORMAT('$ey-$em-$ed', '%Y-%m-%d')", $ilogin_db);

echo $result;

if (mysql_fetch_object($result) == "") {

echo "no results";

 exit;
} 

else
{
echo <<<EOF
<P>The following users are registered:
<P>
<TABLE BORDER=1 bordercolor="#eeeeee">
<TR><td><b>Username</b></td><td><b>Actual Name</b></td><td><b>Email</b></td><td><b>Password</b></td><td><b>Status</b></td><td><b>Edit</b></td></TR>
EOF;
 while ($item = mysql_fetch_object($result))
    &#123;
        $edit = "<A HREF="$PHP_SELF?action=edit&username=$item->username">Edit</A>";
        $delete = "<A HREF="$PHP_SELF?action=delete&username=$item->username">Delete</A>";
        echo "<TR><TD>$item->fnamePermission</TD><TD>$item->currentPhoneCo $item->currentPhoneCo</TD><TD>$item->currentPhoneCo</TD><TD>$item->currentPhoneCo</TD><TD>$item->repID</TD><TD>$edit</TD></TR>";
		
	&#125;
	&#125;
	
	echo <<<EOF
</table>
EOF;
&#125;

feyd | please use formatting

Posted: Tue Feb 15, 2005 2:52 pm
by feyd
mysql_fetch_object() immediately following the query is the problem.


Moved to PHP - Code.

That did it.

Posted: Tue Feb 15, 2005 2:54 pm
by praxedis
Thank you.