What am I doing wrong in this script?

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
esandra
Forum Newbie
Posts: 24
Joined: Sun Aug 30, 2009 11:11 pm

What am I doing wrong in this script?

Post by esandra »

I've tried running this same query in phpmyadmin and it turns out great but I'm not as fortunate when I run it in php.
So, I figured maybe it's in my php code because the query works fine.

This is the error that it returns.
Warning: mysql_fetch_array() expects parameter 1 to be resource, null given in C:\wamp\www\reports.php on line 56

//////////////////////////////////////////
//$date1 and $date2 contains the right values, i checked
$dquery="select distinct `vessel` as `vessel` from `bill` where `dateissue` >= ' ".$date1." ' and `dateissue` <= '".$date2." ' ";
$dres=mysql_query($dquery) or die(mysql_error());
while($drow=mysql_fetch_array($dres)){
$vessel=$drow['vessel'];

echo $vessel;
}
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: What am I doing wrong in this script?

Post by requinix »

mysql_query() never returns null.

Are you sure that's the correct code? Around line 56 in reports.php? Check again.
esandra
Forum Newbie
Posts: 24
Joined: Sun Aug 30, 2009 11:11 pm

Re: What am I doing wrong in this script?

Post by esandra »

thanks for the reply, well it's working now without me changing anything,
although it's giving me a message saying that the server
has gone away


if any one can help me with the server has gone away
problem it'd be much appreciated.

by the way I have more than 511, 000 files in my database and counting
I know this is one of the reasons
also the reason why it takes around 12 minutes for the page to load

yes 12

Is this something that I could solve by making some changes and modifications
in my http config?
Post Reply