SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Aug 2006
    Location
    Canada
    Posts
    38
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Moved site to new server, get plenty of errors?!

    I'm getting these errors

    Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /var/www/clients/client10/web13/web/index.php on line 137

    Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /var/www/clients/client10/web13/web/index.php on line 138
    Here's the code

    $result = mysql_query("SELECT content_".$language." FROM gallery_content WHERE content_id=1");
    list($content)= mysql_fetch_row($result);
    mysql_free_result($result);
    It works fine on the old server, what's going on?

  2. #2
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,510
    Mentioned
    163 Post(s)
    Tagged
    4 Thread(s)
    It means MySQL has thrown an error executing your query.
    Change
    PHP Code:
    $result mysql_query("SELECT content_".$language." FROM gallery_content WHERE content_id=1"); 
    in
    PHP Code:
    $query "SELECT content_".$language." FROM gallery_content WHERE content_id=1";
    echo 
    "query: $query<br />";
    $result mysql_query($query) or die(mysql_error()); 
    The echo will show the query that is actually executed. The 'or die' construction will show you the error.
    Once you get it all to work, delete the echo statement.

    My guess is that on your new server register_globals has been set off (as it should be). For example, the $language variable in your script, where does it come from? A form value? A url passed variable?
    You'll have to use $_GET['language'], $_POST['language'], $_SESSION['language'], depending on the source of the variable.


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
  •