Page 1 of 1

What am I doing wrong in this script?

Posted: Fri Nov 05, 2010 8:49 pm
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;
}

Re: What am I doing wrong in this script?

Posted: Fri Nov 05, 2010 10:37 pm
by requinix
mysql_query() never returns null.

Are you sure that's the correct code? Around line 56 in reports.php? Check again.

Re: What am I doing wrong in this script?

Posted: Sat Nov 06, 2010 1:18 am
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?