Loading list from Database.
Moderator: General Moderators
Loading list from Database.
I was curious as to how I would populate a list from a database.
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;
}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.]
Edit: For clarification, if you want, visit my website... http://dumbass.ionichost.com [Beware the advertisement popup... damn free host.]