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>"; } ?>

  Latest articles

Surviving The Search Wars - Local Directories

SEO One-Way Web Links: 5 Strategies

Getting The Kinks Out Of Links

Promoting Your Business Website - The never-ending work to get traffic

Ze Network © 2006 Free Space Australia Inc. All rights reserved. Pagerank

Mobile Games   Wallpaper World   Tran Community