Friday, 6 September 2013

MYSQL & PHP News System

MYSQL & PHP News System

i have this news system but i can't figure out how to do it like this:
news.php?id=1 then it will ouput the news id 1. Please help. I have looked
for allot of tutorials online, but can't find any that works and are good
i have this sofar:
<?php
include_once('includes/config.php');
if($id != "") {
$id = mysql_real_escape_string($id);
$sql = mysql_query("SELECT * FROM news WHERE id = '$id'");
}
$res = mysql_query($sql);
while($row = mysql_fetch_assoc($res)){
if(isset($_GET['id']));
echo $res['body'];
}
?>
It connectes in the config to the db that's no problem.

No comments:

Post a Comment