redpedia Posted May 14, 2008 Share Posted May 14, 2008 Hello I've a problem , I've made a insert page and edit page for simple article, in the edit page , I've put a article name and edit , delete links first problem is when i move the mouse above the edit link it gives this link in the IE status bar http://localhost/news/edit_outputarticle.php?=0000000001 Why there is many of zeros ! , while i just have to records in the database ! Problem two , I've made an Output edit article page to edit the article fields , the problem is i can't dedicate to the code that i need article number 1 or 2 or 3 ... with where syntax . here is the code <?php include "config.php"; $query=mysql_query("select * from article where id="); $fetch=mysql_fetch_array($query); ?> what should i put in where syntax here ? thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/105599-solved-edit-article-fields-how-can-i-dedicate-the-id/ Share on other sites More sharing options...
craygo Posted May 14, 2008 Share Posted May 14, 2008 Not sure what the zero's are for but you might want to fix that first. There should also be a name for the value. http://localhost/news/edit_outputarticle.php?id=0000000001 As far a getting the id for your query use this <?php include "config.php"; $id = $_GET['id']; $query=mysql_query("select * from article where id='$id'"); $fetch=mysql_fetch_array($query); ?> Ray Quote Link to comment https://forums.phpfreaks.com/topic/105599-solved-edit-article-fields-how-can-i-dedicate-the-id/#findComment-540981 Share on other sites More sharing options...
redpedia Posted May 14, 2008 Author Share Posted May 14, 2008 sorry but id didn't work also it gives me this erorr Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\AppServ\www\news\edit_outputarticle.php on line 18 Quote Link to comment https://forums.phpfreaks.com/topic/105599-solved-edit-article-fields-how-can-i-dedicate-the-id/#findComment-541336 Share on other sites More sharing options...
craygo Posted May 15, 2008 Share Posted May 15, 2008 add some error checking <?php include "config.php"; $id = $_GET['id']; $query=mysql_query("select * from article where id='$id'") or die(mysql_error()); $fetch=mysql_fetch_array($query); ?> Ray Quote Link to comment https://forums.phpfreaks.com/topic/105599-solved-edit-article-fields-how-can-i-dedicate-the-id/#findComment-541510 Share on other sites More sharing options...
redpedia Posted May 15, 2008 Author Share Posted May 15, 2008 thanks , i think its working Erorr found is i've forget to name the link like edit.php?id= thanks ray Quote Link to comment https://forums.phpfreaks.com/topic/105599-solved-edit-article-fields-how-can-i-dedicate-the-id/#findComment-541526 Share on other sites More sharing options...
redarrow Posted May 15, 2008 Share Posted May 15, 2008 preg_match the id mate.. <?php include "config.php"; $id =$_GET['id']; if(preg_match("/[0-9]/",$id)){ $query=mysql_query("select * from article where id='$id'") or die(mysql_error()); $fetch=mysql_fetch_array($query); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/105599-solved-edit-article-fields-how-can-i-dedicate-the-id/#findComment-541529 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.