laczfinador 0 Posted December 25, 2009 Report Share Posted December 25, 2009 (edited) Hello World!I am somewhat inexperienced in PHP and have stumbled upon a problem. I have a nice .php script that shows us the contents of a database table, one row per database entry. I wish to create an edit/delete button at the end of each row. I came up with a quick solution: why not use links and forward the variables with a query string to the edit/delete php script? Well, I figured, that this might not be the most secure option, because the href attribute is viewable by anyone... my question is: can anyone introduce me to some more sophisticated ways of achieveng this goal?Here is the code I am using: require("mysql_connect.php");//This page is accessible through a search form.//If the user left the username field empty,//every user should be listed. There will be//an else statement where pattern matching is used...if($_GET['username']==""){ $sql="SELECT * FROM users"; $result=mysql_query($sql);}while($row=mysql_fetch_row($result)){echo $row[1]." - ".$row[2]."(".$row[3].")<br />";}echo "<a href=\"newuser.htm\">back</a>"; Edited December 25, 2009 by laczfinador Quote Link to post Share on other sites
gar onn 0 Posted December 25, 2009 Report Share Posted December 25, 2009 I think you are looking for a db_management systemso try PHPMyAdminhttp://www.phpmyadmin.net/home_page/try.php Quote Link to post Share on other sites
laczfinador 0 Posted December 25, 2009 Author Report Share Posted December 25, 2009 Hey there gar onn!Unfortunatelly that is not the case... I need to hand-code this operation on a webpage, so that someone non-technical can edit the database entries - but thanks anyways, phpmyadmin is indeed a great application! Quote Link to post Share on other sites
Synook 47 Posted December 26, 2009 Report Share Posted December 26, 2009 A link to the edit/delete script is fine, you can always check the user's permissions at the start of the linked script. Quote Link to post Share on other sites
Panta 1 Posted December 27, 2009 Report Share Posted December 27, 2009 A link to the edit/delete script is fine, you can always check the user's permissions at the start of the linked script.Can you tell me how to cheack for the login Quote Link to post Share on other sites
Err 10 Posted December 28, 2009 Report Share Posted December 28, 2009 (edited) $user = (isset($_SESSION['user'])) ? $_SESSION['user'] : "";// or whatever method you use to check if a user is logged inif ($user) { // whatever you want to do here} If you do have a permissions level, then you would have to query the database, retrieve it and pass it through an IF statement. Edited December 28, 2009 by RahXephon Quote Link to post Share on other sites
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.