ntin0s Posted November 19, 2010 Share Posted November 19, 2010 Hello, I am a new user here and new in php coding also. I am a student and i have this task to create a simple website and I am stacked at the Amend and Delete data, so i could really use any help asap. I really need your help because i have to finish this now. I have this search.php that searches my users and displays the user-names and next to them an Amend and a Delete button the links are like this: echo "<a href=:\"amend.php?id=" . $a_row['username'] . "\">Amend user</a>"; echo "<span> </span>"; echo "<a href=:\"delete.php?id=" .$a_row['username'] . "\">Delete user</a>" what code should i have in amend.php to make this work? Thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/219244-need-a-simple-amend-and-delete-code/ Share on other sites More sharing options...
snowman15 Posted November 19, 2010 Share Posted November 19, 2010 in amend.php and delete.php you would probably want some database code. You need to be more specific to receive some help. Quote Link to comment https://forums.phpfreaks.com/topic/219244-need-a-simple-amend-and-delete-code/#findComment-1136959 Share on other sites More sharing options...
.josh Posted November 19, 2010 Share Posted November 19, 2010 look at the basic database handling tut on the main site. Quote Link to comment https://forums.phpfreaks.com/topic/219244-need-a-simple-amend-and-delete-code/#findComment-1136961 Share on other sites More sharing options...
ntin0s Posted November 19, 2010 Author Share Posted November 19, 2010 on my search users i have this link "<a href=:\"amend_form.php?id=" . $a_row['username'] . "\">Amend user</a>" the amend_form.php is like this <html> <body> <H1>Amend existing user<H1> <form action="Amend.php" method="post"> Username: <input type="text" name="username"value="<?=$keywords?>""> <input type="submit" value="Amend" </form> </body> </html> and the amend.php <?$keywords = $_POST['keywords']; setcookie("keywords", $keywords); ?> <?php $con = mysql_connect("localhost","*****","*****"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("******", $con); $sql="UPDATE Users SET username='$_POST[username]' WHERE username='$_POST[keywords]'"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "User details successfully updated"; mysql_close($con) ?> Everything is messud up and i really need some help Quote Link to comment https://forums.phpfreaks.com/topic/219244-need-a-simple-amend-and-delete-code/#findComment-1136964 Share on other sites More sharing options...
ntin0s Posted November 19, 2010 Author Share Posted November 19, 2010 I tried many tutorials but nothing seems to work because everything is messed up and i have 2 hours to finish this Quote Link to comment https://forums.phpfreaks.com/topic/219244-need-a-simple-amend-and-delete-code/#findComment-1136966 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.