Click to See Complete Forum and Search --> : Listing content


troy1984
11-07-2003, 02:44 AM
Hi all,

I have a database in Mysql called "database1" and in that database i got a tabel callede "tabel" and in there i got a field called "users". I want to Generate e menu (simpel tekst links).

For every user in my database there must be a tekst link linking to the page that is the same as the name of the user.

FE: User1 links to user1.html or something like that.

Any one who knows a script for this or can help me.

Thank you in advance,
troy

AdamGundry
11-07-2003, 04:05 AM
Something like this (untested)?

<?php
@mysql_connect('server', 'username', 'password') or die('Unable to connect to MySQL server.<p>Error: ' . mysql_error());
mysql_select_db('database1');
$resultID = mysql_query('select users from table');
while ($row = mysql_fetch_row($resultID)){
$user = $row[0];
echo "<a href=\"$user.html\">$user</a>";
}
?>

Adam

troy1984
11-07-2003, 06:53 AM
Works Great!:D:D
Tnx a lot

Greetings,
Troy