PDA

View Full Version : SQL & PHP problem



foxpro
04-02-2006, 11:17 PM
Hello.
I have a problem.
How i can show in the page an specify id of a SQL table.
{Perdon por mi ingles}

NXArmada
04-10-2006, 02:09 PM
try this:



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