#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2000
    Posts
    38
    Rep Power
    15
    got a problem...
    okay, i'm pulling the info out of a mysql table just fine. I got that.
    It's when it comes to making an array out of it that i have a problem...

    i have:
    $result=mysql_query("select * from news");
    while ($row=mysql_fetch_row($result)) {
    $date=$row[1];
    $ID=$row[4];
    $array=array($ID => $date);
    }

    what I want to do is make an array that uses the ID number as the key and puts the date (a unix timestamp) as the value. It works, but the code that i have there only works for the last one and it over writes the others.

    any ideas?

    [This message has been edited by enygma (edited May 18, 2000).]
  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
    18
    Change the array assignment line to:

    $array[$ID]=$date;

Similar Threads

  1. MySQL query not getting array properly [PHP]
    By adz32 in forum MySQL Help
    Replies: 1
    Last Post: February 11th, 2004, 03:51 PM
  2. Inserting checkbox values from an array into MySQL
    By outlyr242 in forum PHP Development
    Replies: 1
    Last Post: February 9th, 2004, 04:28 PM
  3. Replies: 2
    Last Post: January 14th, 2004, 05:07 PM
  4. Replies: 4
    Last Post: January 14th, 2004, 05:22 AM
  5. populate array with mysql data
    By clearbar in forum PHP Development
    Replies: 2
    Last Post: January 14th, 2004, 03:41 AM

IMN logo majestic logo threadwatch logo seochat tools logo