I have a mysql data-base that stores data: ID, location, time, date and price.
I also have a script that will generate a table from an array where it will input all the correct infromation from the array to the table in its own cell or row.
This works fine only slightly not what i want, i am a bit stuck now, the array is in the php script itself which is not what i want, i need it to be from a mysql data-base which i managed to do and was able to pull the data out.
now what i need to do is instead of it pulling the array from the php file like so
[php]$PRODUCTS = array(
‘event1’ => array(‘Newtown Powys’, 1.25, ‘01/12/2012’, ‘01.00 PM’),
‘event2’ => array(‘Welshpool Powys’, .99, ‘02/12/2012’, ‘02.30 PM’),
‘event3’ => array(‘Berriw Powys’, 1.35, ‘03/12/2012’, ‘11.30 AM’)
); [/php]
i need it to be the mysql data i pulled out which is very similar to the above.
I can print out the array using general code to print it like such obviously
[php]printf ("ID: %s
Name: %s
Date: %s
Added: %s
", $row[0], $row[“location”], $row[“datetime”], $row[“altdate”]);[/php]
which will display all the rows in the data base on the page just by printing them.
so how do i get them to show in the table in the correct order that i need them?
i did something like
[php]$PRODUCTS = array(
$row[0] => array($row[“location”], 1.25, ‘01/12/2012’, ‘01.00 PM’),
);
[/php]
which is kind of what i need but it will only pull out the first row of the data base, now how would i get it to pull them all out and put it in to the table, the bit above does put it in to the table correctly how i want it i just need to know how to get it to pull all the rows out
I appoligies if this is not very clear i had a hard time trying to explain it lol
and i also appoligies if this is in the wrong place, wasent to sure as some of it is php and some is mysql.
Thanks in advance!