php errors in my script

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mayanktalwar1988
Forum Contributor
Posts: 133
Joined: Wed Jul 08, 2009 2:44 am

php errors in my script

Post by mayanktalwar1988 »

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..
Last edited by mayanktalwar1988 on Wed Jul 22, 2009 2:50 pm, edited 1 time in total.
spider.nick
Forum Commoner
Posts: 72
Joined: Wed Jul 15, 2009 12:22 pm
Location: Overland Park, KS

Re: php errors in my script

Post by spider.nick »

Click 'Edit' on your first post, and apply "[ code=php ]" and "[ /code ]" around your PHP code, minus the extra space between the "[ and c", the "p and ]", etc.

Nick
mayanktalwar1988
Forum Contributor
Posts: 133
Joined: Wed Jul 08, 2009 2:44 am

Re: php errors in my script

Post by mayanktalwar1988 »

ok ok dont reply to this..this script is ok.sorrryy.silly mistake
Post Reply