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 2006
    Posts
    84
    Thanks
    0
    Thanked 0 Times in 0 Posts

    error: mysql_fetch_array(): supplied argument is not a valid MySQL

    $result = mysql_query("SELECT FROM at ORDER BY pubdate DESC LIMIT 25");

    $AT_array;
    $i=0;
    while($row = mysql_fetch_array($result, MYSQL_NUM))
    {
    $AT_array[$i]=array($row[0],$row[1],$row[2],$row[3]);
    $i++;
    }

    Why doesn't this work?. I'm tryig to store data from MySQL into an array.

  • #2
    DSB
    DSB is offline
    New Coder
    Join Date
    Mar 2006
    Posts
    33
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Macintosh

    PHP Code:
    $arr = array();

    $result mysql_query("SELECT FROM at ORDER BY pubdate DESC LIMIT 25");

    while(
    $row mysql_fetch_array($result){ $arr += $row; } 
    Last edited by DSB; 09-05-2006 at 01:08 AM.

  • #3
    Senior Coder
    Join Date
    Sep 2005
    Posts
    1,791
    Thanks
    5
    Thanked 36 Times in 35 Posts
    The error you're getting means the query is invalid.
    You're not actually telling mysql which fields you want to select, you should list them, separated by commas between 'SELECT' and 'FROM'
    e.g.
    SELECT id, name, birthday FROM at


  •  

    Posting Permissions

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