arrays and mysql data
Posted: Fri Nov 28, 2008 4:24 am
Hi all,
I'm after a bit of help with arrays.
I have established a connection to the data base by using the code below and i have selected all the info i need from the database ($sql).
However, i have a list of ids in a session related to the query below.
How can i retrieve the name using the id's from my session?
Any help would be GREATLY appreciated!
Thanks,
C
I'm after a bit of help with arrays.
I have established a connection to the data base by using the code below and i have selected all the info i need from the database ($sql).
However, i have a list of ids in a session related to the query below.
How can i retrieve the name using the id's from my session?
Any help would be GREATLY appreciated!
Thanks,
C
Code: Select all
$sql = mysql_query("SELECT id, name FROM products");
$names = mysql_fetch_array ($sql);
if(!$sql) {
die("<p>There was an error running the query.</p>");
}