laczfinador Posted December 25, 2009 Share Posted December 25, 2009 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>"; Link to comment Share on other sites More sharing options...
gar onn Posted December 25, 2009 Share Posted December 25, 2009 I think you are looking for a db_management systemso try PHPMyAdminhttp://www.phpmyadmin.net/home_page/try.php Link to comment Share on other sites More sharing options...
laczfinador Posted December 25, 2009 Author 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! Link to comment Share on other sites More sharing options...
Synook Posted December 26, 2009 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. Link to comment Share on other sites More sharing options...
Panta Posted December 27, 2009 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 Link to comment Share on other sites More sharing options...
Err Posted December 28, 2009 Share Posted December 28, 2009 $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. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.