#1
  1. Banned (not really)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 1999
    Location
    Brussels, Belgium
    Posts
    14,646
    Rep Power
    4492
    Hi. I'm getting this error when trying to execute the following php code.

    Warning: Supplied argument is not a valid MySQL result resource in /export/vol2/httpd/htdocs/academic/engineering/leap/test.php on line 22

    code:
    21. $query = mysql_db_query($database,"SELECT * FROM users",$link_id);
    22. $result = mysql_fetch_array($query);

    This code works with no errors on my home machine. I have established a connection and $database and $link_id are correct. The databases are on different systems, but i used the same statements to create them. I have the same privledges in each database. Any ideas what could be causing this error??

    ---John Holmes
    ---www.SepodatiCreations.com
  2. #2
  3. No Profile Picture
    Apprentice Deity
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 1999
    Location
    Niagara Falls (On the wrong side of the gorge)
    Posts
    3,237
    Rep Power
    19
    Are you sure $link_id is correct? Try dropping it as it isn't neccesary unless you have multiple connections to multiple mysql servers open.
  4. #3
  5. Banned (not really)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 1999
    Location
    Brussels, Belgium
    Posts
    14,646
    Rep Power
    4492
    I tried this code and am still getting the same errors:

    20: $link_id = mysql_connect("localhost","johnson","tifdrjee");
    21: $query = mysql_db_query($database,"SELECT * FROM users");
    22: $result = mysql_fetch_array($query);

    If this works in one database, what could be different in the other database to not allow this?

    ---John Holmes
  6. #4
  7. No Profile Picture
    Apprentice Deity
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 1999
    Location
    Niagara Falls (On the wrong side of the gorge)
    Posts
    3,237
    Rep Power
    19
    Have you printed $link_id? You may not be getting connected. Try this after the connect:

    if (!$link_id) print mysql_error();

    I bet you'll find something is wrong with the mysql userid or password. Are you POSITIVE they are the same on both servers?
  8. #5
  9. Banned (not really)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 1999
    Location
    Brussels, Belgium
    Posts
    14,646
    Rep Power
    4492
    It says $link_id is set ok.

    On my home computer I deleted the extensions_dir setting in the php.ini file and when i loaded up the page, it gave me this same error, so i think the problem might be with their php.ini file on the server. (????)

    ---John Holmes

Similar Threads

  1. Replies: 5
    Last Post: December 14th, 2003, 12:18 AM
  2. not a valid MySQL result resource
    By alan1470 in forum PHP Development
    Replies: 2
    Last Post: November 30th, 2003, 09:55 PM
  3. Not a valid MySQL result resource
    By tanmy_1999 in forum MySQL Help
    Replies: 2
    Last Post: June 3rd, 2003, 11:14 AM
  4. Replies: 6
    Last Post: November 28th, 2000, 01:06 PM
  5. Fixing a valid mysql result resource error
    By HanSolo2 in forum PHP Development
    Replies: 8
    Last Post: November 2nd, 2000, 10:22 AM

IMN logo majestic logo threadwatch logo seochat tools logo