Results 1 to 5 of 5
  1. #1
    Animal Lover
    Join Date
    January 18th, 2005
    Location
    oz
    Posts
    1,210
    I'm really new to php and mysql but I'm learning slowly...I'm having problems with this script - the error I get says

    Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource

    What does it mean? It seems to be connecting to the database and table okay - no error message...just this. The Thumbnail field contains the urls of the products..

    The script reads :

    $sql = "SELECT Thumbnail FROM body WHERE Name = 'blahblah'";
    $query = mysql_query ($sql);

    while ($fetch = mysql_fetch_array ($query))
    {
    echo "<img src='".$fetch."'>";
    }

    Oscar
    My DataFeed Scripts - php datafeed scripts for your site
    Shareasale datafeed scripts - to display Shareasale datafeeds
    Linkshare datafeed scripts - for multiple Linkshare merchants

  2. #2
    Intergalactic Trader IGshop's Avatar
    Join Date
    January 18th, 2005
    Posts
    87
    Oscar,

    I use the mysql_fetch_object, but do have some code using arrays. You need to call out the thumbnail key to get the value of the array:

    while ($fetch = mysql_fetch_array ($query))
    {
    echo "<img src='".$fetch["thumbnail"]."'>";
    }

    Jim

  3. #3
    Animal Lover
    Join Date
    January 18th, 2005
    Location
    oz
    Posts
    1,210
    Thanks Jim, I'll try it out.

    Oscar
    My DataFeed Scripts - php datafeed scripts for your site
    Shareasale datafeed scripts - to display Shareasale datafeeds
    Linkshare datafeed scripts - for multiple Linkshare merchants

  4. #4
    ABW Ambassador
    Join Date
    January 18th, 2005
    Location
    ÄúsTrálíĺ
    Posts
    1,372
    if Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource is your error, then the problem is is this section
    <BLOCKQUOTE class="ip-ubbcode-quote"><font size="-1">quote:</font><HR>$sql = "SELECT Thumbnail FROM body WHERE Name = 'blahblah'";
    $query = mysql_query ($sql); <HR></BLOCKQUOTE>
    Check your table and column names etc, and any quotes etc you have used

  5. #5
    Animal Lover
    Join Date
    January 18th, 2005
    Location
    oz
    Posts
    1,210
    Okay I found out where the problem was...would you believe I forgot to add the user to the database???

    Don't say it, I know...

    Oscar
    My DataFeed Scripts - php datafeed scripts for your site
    Shareasale datafeed scripts - to display Shareasale datafeeds
    Linkshare datafeed scripts - for multiple Linkshare merchants

  6. Newsletter Signup

+ Reply to 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
  •