SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Guru
    Join Date
    Aug 2004
    Location
    Canada
    Posts
    730
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Why doesn't fetch_array work on a remote server?

    It works on a local server but not on a remote.
    Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in e:\vhosts\...\files\getTableContents.php on line 15
    Compare bible texts (and other tools):
    TheWheelofGod

  2. #2
    . shoooo... silver trophy logic_earth's Avatar
    Join Date
    Oct 2005
    Location
    CA
    Posts
    9,013
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    It tells you, supplied argument is not a valid MySQL result resource.
    Logic without the fatal effects.
    All code snippets are licensed under WTFPL.


  3. #3
    SitePoint Guru
    Join Date
    Aug 2004
    Location
    Canada
    Posts
    730
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by logic_earth View Post
    It tells you, supplied argument is not a valid MySQL result resource.
    What should I do then?
    Compare bible texts (and other tools):
    TheWheelofGod

  4. #4
    . shoooo... silver trophy logic_earth's Avatar
    Join Date
    Oct 2005
    Location
    CA
    Posts
    9,013
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    Check mysql_query make sure it has not errored out, as well as mysql_connect.
    Logic without the fatal effects.
    All code snippets are licensed under WTFPL.


  5. #5
    SitePoint Guru
    Join Date
    Oct 2006
    Location
    Queensland, Australia
    Posts
    852
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Correct your database details, then it will work!

  6. #6
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    If you cannot get a hold of mysql_errno() or similar then echo your sql statement to the screen, copy it, paste it into PhpMyAdmin and make sure it is valid - this is usually the problem when I see that error. Something somewhere is not adding the expected variable into your sql statement.
    temporarily open up:
    e:\vhosts\...\files\getTableContents.php

  7. #7
    SitePoint Wizard Hammer65's Avatar
    Join Date
    Nov 2004
    Location
    Lincoln Nebraska
    Posts
    1,161
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If there is any difference between the database on the remote and the one on your local machine, it could be causing the query to fail. A common problem I see with scripts using MySQL is that proper checking isn't done from end to end, to ensure that everything worked. All of the MySQL functions return a value that evaluates to false if there is a problem. From the time you connect till the time that the connection is closed, there are any number of things that can go wrong.

    You would never get that error if you had evaluated what mysql_query returned first before trying to get a result set, that doesn't exist.
    Visit my blog
    PHP && Life
    for technology articles and musings.


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
  •