Page 1 of 1
Loading list from Database.
Posted: Fri Aug 12, 2005 8:19 am
by theda
I was curious as to how I would populate a list from a database.
Posted: Fri Aug 12, 2005 8:21 am
by feyd
what kind of list?
Posted: Fri Aug 12, 2005 8:23 am
by onion2k
I tend to do something along the lines of:
Code: Select all
$list = array();
$sql = "select name from table";
$result = mysql_query($sql,$databaseConnection);
while ($record = mysql_fetch_object($result)) {
$list[] = $record->name;
}
Posted: Fri Aug 12, 2005 8:26 am
by theda
Well the list is mainly for me to make a database driven website. Basically I want the script to search a certain database, find the contents (which will be the pages of my website), and then list them out. (Later on, I'll be asking how do I make the list able to be clicked as a link and open the corresponding data...)
Edit: For clarification, if you want, visit my website...
http://dumbass.ionichost.com [Beware the advertisement popup... damn free host.]
Posted: Fri Aug 12, 2005 8:32 am
by feyd
onion2k's example is along those lines, I believe.