SitePoint Sponsor

User Tag List

Results 1 to 11 of 11

Threaded View

  1. #1
    SitePoint Evangelist hessodreamy's Avatar
    Join Date
    Apr 2005
    Location
    uk
    Posts
    524
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    Really stupid debugging question because I'm losing my mind

    I'm trying to debug some code from previous developer (ie I wouldn't normally program like this) and I've got an error I just can't get rid of. The code below results in the output beneath it.

    What I can't figure out is how execution gets to the point of error, because the query result has already been checked (and output). Basically I'm confused and am losing the plot. Can anyone help?

    PHP Code:
    $res   mysql_query($query);
    if(!
    $res) continue; //skip out of this loop iteration

    $rows mysql_num_rows($res);

    if (
    $rows>0)
    {
        echo 
    "Res : ";
        
    var_dump($res);
        while (
    $row mysql_fetch_array($res)) //this is line 125
        
    {
    ...... 
    Code:
    Res : resource(22) of type (mysql result)
    PHP Warning:  mysql_fetch_array() expects parameter 1 to be resource, boolean given in <snip />/getDetails.php on line 125
    Last edited by DaveMaxwell; Mar 21, 2013 at 07:49. Reason: removed URL for security concerns....


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •