[RESOLVED] STill working on converting to mysqli from mysql more issues
Results 1 to 3 of 3

Thread: [RESOLVED] STill working on converting to mysqli from mysql more issues

  1. #1
    Member
    Join Date
    Dec 2007
    Posts
    71

    resolved [RESOLVED] STill working on converting to mysqli from mysql more issues

    In the past I had this query
    $query="select `imag_url` from `inventy` where `shop`='".$shop."' and `qty`>='".$cnfig['shop_min_qty']."' and `cat`='".$row3->cat."' and `imag_url`!='' order by rand() limit 1";
    Using this result/row
    $row = mysql_fetch_object($result);
    echo $row->imag_url
    and it worked fine. I convert it to use the same query with this row/result
    $row=$result->fetch_object;
    echo $row->imag_url
    and I get no imag_url echoed back. I can test the row exists with $result->num_rows and I get '1' but can't get anything out of the row.

    I finally got it to work by using
    $row=$result->fetch_row();
    echo $row[0];
    I've got the $result->fetch_object in other places fetching only one row and it works. Can anyone tell me why it wouldn't work here? Is there something to do with the selecting one at random? This one has me really confused and I'd really like to know why.

  2. #2
    Pna lbh ernq guvf¿
    Join Date
    Jul 2004
    Location
    Kansas City area
    Posts
    19,403
    Function calls use '()'. $result->fetch_object isn't a function call; $result->fetch_object() is.

  3. #3
    Member
    Join Date
    Dec 2007
    Posts
    71
    Darn I would have sworn it was on there. I swear I've been looking at this too long. Thanks I'll try not to be stupid.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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