Thread: mysql error

    #1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    7
    Rep Power
    0
    I'm getting this error:

    Warning: MySQL: Unable to save result set in /www/hosts/wwwroot/mainPage.php on line 11

    Here is what line 11 looks like:

    $articles = mysql_query("select entryID from articles where siteID like 'senior'");

    Any help on this error would be greatly appreciated.
  2. #2
  3. .Net Developer
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Location
    London
    Posts
    987
    Rep Power
    15

    $articles = mysql_query("select entryID from articles where siteID like 'senior'");


    Just pass connection string also with mysql query.

    eg:

    <?

    $con=mysql_connect('localhost','usr','pwd');

    mysql_select_db('databasename',$con);
    //select database
    $articles = mysql_query("select entryID from articles where siteID like '%senior%'",$con);


    $num=mysql_num_rows[$articles];

    if $num>0{
    echo " Record is fetchingn";
    }else{
    echo "No Recordsn";
    exit;
    }

    ?>


    ------------------
    SR -
    shiju.dreamcenter.net

    "The fear of the LORD is the beginning of knowledge..."

    [This message has been edited by Shiju Rajan (edited June 12, 2000).]
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    7
    Rep Power
    0
    No this didn't work, I still get the same error. Even when I run the same query directly in the database, I get the same error. Meaning could this error be due to something other than php?
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2000
    Posts
    63
    Rep Power
    15
    Can you show more of your work... mainly how you connect to the db etc.
  8. #5
  9. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    7
    Rep Power
    0
    $hostname = "localhost";
    $username = "joe";
    $dbName = "sb";
    MYSQL_CONNECT($hostname,$username) OR DIE("Unable to connect to database");
    @mysql_select_db("$dbName") or die("Unable to select database");

    $links = mysql_query("select entryID from links
    where siteID like 'senior'");
    $linksNumber = mysql_num_rows($links);

    $articles = mysql_query("select entryID from articles where siteID like 'senior'");
    $articlesNumber = mysql_num_rows($articles);?>

    The query that selects from the links table works fine, but the one that selects from the articles table doesn't. I seem to get this error when the field siteID is used in the query for the articles table. I don't know if the actual problem is with the database or mysql because the error shows up even when I do a query directly in the database.
  10. #6
  11. .Net Developer
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Location
    London
    Posts
    987
    Rep Power
    15

    The query that selects from the links table works fine, but the one that selects from the articles table doesn't. I seem to get this error when the field siteID is used in the query for the articles table. I don't know if the actual problem is with the database or mysql because the error shows up even when I do a query directly in the database.


    Just check it out wether your "siteID" field is spelled it correctly or not.

    Check the table name and field names directly in your mysql.




    ------------------
    SR -
    shiju.dreamcenter.net

    "The fear of the LORD is the beginning of knowledge..."
  12. #7
  13. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2000
    Posts
    63
    Rep Power
    15
    Try this... use the connection id for your queries...

    $hostname = "localhost";
    $username = "joe";
    $dbName = "sb";
    MYSQL_CONNECT($hostname,$username) OR DIE("Unable to connect to database");
    $myconn = mysql_select_db("$dbName") or die("Unable to select database");
    $links = mysql_query("select entryID from links
    where siteID like 'senior'", $myconn );
    $linksNumber = mysql_num_rows($links);

    $articles = mysql_query("select entryID from articles where siteID like 'senior'", $myconn);
    $articlesNumber = mysql_num_rows($articles);?>

Similar Threads

  1. Custom error message for MySQL connection
    By dbr1066 in forum PHP Development
    Replies: 6
    Last Post: February 12th, 2004, 11:25 AM
  2. MySQL Error Access denied for user error
    By krishna_seshayy in forum MySQL Help
    Replies: 0
    Last Post: February 11th, 2004, 11:06 PM
  3. Mysql error
    By AIC in forum PHP Development
    Replies: 4
    Last Post: February 11th, 2004, 12:27 PM
  4. mysql: getting error description from error code
    By laker in forum PHP Development
    Replies: 1
    Last Post: January 21st, 2004, 06:03 AM
  5. Scratch table error in MySQL
    By byte me in forum MySQL Help
    Replies: 11
    Last Post: January 20th, 2004, 11:51 AM

IMN logo majestic logo threadwatch logo seochat tools logo