First record getting dropped

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
praxedis
Forum Newbie
Posts: 6
Joined: Tue Feb 15, 2005 2:34 pm

First record getting dropped

Post 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);
praxedis
Forum Newbie
Posts: 6
Joined: Tue Feb 15, 2005 2:34 pm

Search

Post 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.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

the first record where? post more code please.
praxedis
Forum Newbie
Posts: 6
Joined: Tue Feb 15, 2005 2:34 pm

okey doke

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

mysql_fetch_object() immediately following the query is the problem.


Moved to PHP - Code.
praxedis
Forum Newbie
Posts: 6
Joined: Tue Feb 15, 2005 2:34 pm

That did it.

Post by praxedis »

Thank you.
Post Reply