php errors in my script
Posted: Wed Jul 22, 2009 2:27 pm
Code: Select all
<?php
if (isset($_GET['id'])){
$host = "localhost";
$user = "root";
$pass = "";
$db = "ask";
$con = mysql_connect($host,$user,$pass);
mysql_select_db($db,$con);
$id = $_GET['id'];
echo "<a href='create_topic.php?id=$id'>New topic</a>";
echo "<table border='0' width='100%'>";
$sql = mysql_query("SELECT * FROM topics WHERE cat_id='".$id."'");
while($row = mysql_fetch_array($sql)) {
echo "<tr><td>".htmlentities($row['title'])."</td></tr>
<tr><td>".str_replace("\n","<br />",htmlentities($row['post']))."</td></tr>
<tr><td><a href='mailto:".$row['mail']."'>".htmlentities($row['author'])."</a></td></tr>
<tr><td>".date("j/n - y",$row['date'])."</td></tr>";
}
echo "</table>";
mysql_close($con);
} else {
echo "invalid usage!";
}
?>
the above file is not giving any error...but this line echo "<a href='create_topic.php?id=$id'>New topic</a>"; from above is not producing the link create_topic?id=some id value..it is only producing create_topic.php in browser whats is the problem with this..