Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Aug 2002
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Angry I just don't get why this isn't working!

    I just can't see the error here:

    $con = mysql_connect($db_host, $db_username, $db_password);
    mysql_select_db($db_database);
    $result = mysql_query("SELECT * FROM $db_table[0] WHERE poll_id = $id",$con);
    while ($myrow = mysql_fetch_array($result, MYSQL_BOTH)) {
    echo"working";
    }

    Anyone?

    It's in php just so you know and i get the error:

    Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in d:\www\thespot\functions.inc.php on line 33

    (line 33 is the while line)

  • #2
    mat
    mat is offline
    Regular Coder
    Join Date
    Jul 2002
    Posts
    199
    Thanks
    0
    Thanked 0 Times in 0 Posts
    what does MYSQL_BOTH do?

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Location
    UK
    Posts
    577
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Try dropping all the superflous parameters and see if it runs

    $con = mysql_connect($db_host, $db_username, $db_password);
    mysql_select_db($db_database);
    $result = mysql_query("SELECT * FROM '$db_table[0]' WHERE poll_id = '$id'");
    while ($myrow = mysql_fetch_array($result)) {
    echo 'working - '.$myrow[0].'<br>
    ';
    }
    echo mysql_error();

    If that still throws probs, you might try mysql_fetch_row and test again. The mysql_error output should point toward mysqls version of what is glitching.

    Edit: MYSQL BOTH just tells mysql to return rows in arrays that are indexed by both the numeric $array[0] and by association $array[fieldname]
    Last edited by Ökii; 09-14-2002 at 08:55 AM.
    Ökii - formerly pootergeist
    teckis - take your time and it'll save you time.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •