Web Hosting Talk







View Full Version : MySql Error... $Result_set


RobertMaltby
06-03-2005, 01:16 AM
Im getting this error:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/profoun/public_html/helpdesk/includes/functions.php on line 577

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/profoun/public_html/helpdesk/includes/functions.php on line 577

But Im not quite sure whats causing this to happen all of a sudden..
Line 572 thru 596
function fetch_row($result_set, $dorowset = false ) {

/* Kinder edits */
if( !$dorowset ) {

return mysql_fetch_array($result_set);
}
if( $dorowset ) {
/* Load into $this->rowset as an array */
while( $this->rowset[ $result_set ] = mysql_fetch_array( $result_set ) )

{

$result[] = $this->rowset[ $result_set ];

}



return $result;
}



}


Everything worked flawlessly then it gives me this error.. i have tried re-uploading the original files without my edits but that hasnt worked / helped..

Most of my functions use $result_set as a parameter / arguement..

I can upload the full Functions.php if needed ( However, it is about 2500 lines ..)

Functions.php is the only page to have $result_set in it..

http://profound-hosting.com/helpdesk/viewaccount.php
*Im aware that the buttons on the banner do not work...*

Thanks For your Help in Advance!!

MarkIL
06-03-2005, 07:01 AM
function fetch_row($rs=NULL, $drs=false)
{
if (!mysql_num_rows($rs))
return array();
if (!$drs)
return mysql_fetch_array($rs);
$r = array();
while(false !== ($x = mysql_fetch_array($rs)))
$r[] = $x;
return $r;
}

azizny
06-03-2005, 10:21 AM
just do this: @mysql_fetch_array instead of mysql_fetch_array

the error just says, that the array you sent is empty, adding the @ beforehand will just ignore that error..

Peace,

RobertMaltby
06-03-2005, 10:31 AM
Kick ***... you guys rock :)

It works now... Thanks for the Help :)

Burhan
06-04-2005, 02:06 AM
the error just says, that the array you sent is empty, adding the @ beforehand will just ignore that error..

This is not what the error states. The errror is saying that you did not provide a vaid MySQL result set to mysql_fetch_array.

In other words, $result_set is not a MySQL resource, which means that either your query from where you get $result_set is in error, or there is a problem with your MySQL connection/queries.

I would suggest you use mysql_error. It really baffles me how many people assume that MySQL queries will work correct the first time, and every time after that.

error404
06-04-2005, 02:53 AM
Surpressing errors in such a way is almost always a bad idea. I second fyrestrtr's advice, and urge you to only use the @ operator when you fully handle any errors yourself.

RobertMaltby
06-04-2005, 10:19 AM
thanks guys.. im going to set up a if statement to handle the errors...
Thanks for all your help!!