"Ko & Kylling -
http://knoesen.adsl.dk/thebeat.dk" <clark@cool.dk> wrote in
message news:9jbg30$faf$1@news.cybercity.dk...
> Hvordan får man vist en hel tabel i en database??
Her er eksemplet fra manualen (
http://php.net/mysql ).
Jeg har ændret en while-løkke til en foreach-løkke, men ellers er det
copy-paste:
<?php
$link = mysql_connect("mysql_host", "mysql_login", "mysql_password")
or die ("Could not connect");
print ("Connected successfully");
mysql_select_db ("my_database")
or die ("Could not select database");
$query = "SELECT * FROM my_table";
$result = mysql_query ($query)
or die ("Query failed");
// printing HTML result
print "<table>\n";
while($line = mysql_fetch_array($result)){
print "\t<tr>\n";
foreach($line as $col_name=>$col_value) {
print "\t\t<td>$col_value</td>\n";
}
print "\t</tr>\n";
}
print "</table>\n";
mysql_close($link);
?>
--
Mvh.
Niels Andersen