tienphuonghk Posted May 13, 2010 Share Posted May 13, 2010 Hi Everybody,I have problem with page.I am not looking for error.Please fix for me.Here:<?define("host","localhost");define("user","root");define("pass","anhson67");define("db","tienphuong");$conn=mysql_connect(host,user,pass) or die("Could not connect server");mysql_select_db(db,$conn) or die ("Could not select database");$max=3;$p=$_GET['p'];if(empty($p)){$p=1;}$limit=($p-1)*$max;if(isset($_GET['act']) && $_GET['act']=="view"){$id=$_GET['id'];$sql=mysql_query("select * from searchs where id='$id'");while($row=mysql_fetch_array($sql)){$name=$row['name'];$topic=$row['topic'];$comment=$row['comment'];echo "<div><p>$name</p><p>$topic</p><p>$comment</p></div>";}}else {$sql=mysql_query("select * from searchs limit".$limit.",$max") or die (mysql_error());$total=mysql_result(mysql_query("select count(id) as tot from searchs"),0);$totalpage=ceil($total/$max);while($r=mysql_fetch_array($sql)){$id=$r['id'];$name=$r['name'];$topic=$r['topic'];echo "<div><p><a href='time1.php?act=view&id=$id'>$name</a></p><p>$topic ...<a href='time1.php?act=view&id=$id'>more</a></p></div>";}for($i=1;$i<=$totalpage;$i++){echo "<a href='time1.php?p=$i'>$i | </a>";}}?>And then inform error:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '3' at line 1 Link to comment Share on other sites More sharing options...
Synook Posted May 13, 2010 Share Posted May 13, 2010 I don't see how we can be of much true help if you are not willing to try and troubleshoot yourself. Anyway, you are missing a space after the LIMIT keyword in your second query. Link to comment Share on other sites More sharing options...
tienphuonghk Posted May 14, 2010 Author Share Posted May 14, 2010 I don't see how we can be of much true help if you are not willing to try and troubleshoot yourself. Anyway, you are missing a space after the LIMIT keyword in your second query.Thank you very much,I know why problem.I am really stupid Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.