| php
display mysql database
This is a simple php script to display
the contents of a table in a mysql database. The raw data is displayed
via a html page.
<?
//connect to mysql
//change user and password to your mySQL name and password mysql_connect("localhost","user","password");
//select which database you want to edit mysql_select_db("freespace_news");
//select the table
$result = mysql_query("select * from news");
//grab all the content
while($r=mysql_fetch_array($result))
{
//the format is $variable = $r["nameofmysqlcolumn"];
//modify these to match your mysql table columns
$title=$r["title"];
$message=$r["message"];
$who=$r["who"];
$date=$r["date"];
$time=$r["time"];
$id=$r["id"];
//display the row
echo "$title <br> $message <br> $who <br>
$date | $time <br>"; } ?>
|