Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > PHP Databases
|
PHP Databases Using PHP in conjunction with databases. PHP questions not specific to databases should be directed to one of the other PHP forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 21st, 2009, 09:11 PM
Registered User
 
Join Date: May 2009
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default need help updating and deleting!!!!!!!!!!!!!!!

hey guys, im new to this php and my sql stuff..i need help here.. i can delete/update stuff from the from into the database..but it is only for a specific name..but what i want is to delete/update stuff for any given name...this are the codes..thanks...

:::::THIS IS MY FORM:::::

<form action="delete.php" method="post">
Name: <input type="text" name="name"/>
Age: <input type="text" name="age" />
Hp : <input type="text" name="handphone" />
Email : <input type="text" name="email" />
Admin : <input type="text" name="admin" />
<input type='submit' name='remove' value='Delete' />
</form>
</body>
</html>


:::::THIS IS MY PHP CODES:::::

<?php

$con = mysql_connect("localhost","root","root");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("studentreg", $con);

mysql_query ( "DELETE FROM particulars WHERE name='sam' ");
echo "name deleted!!";
mysql_close($con)

?>
 
Old July 15th, 2009, 03:36 AM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 479
Thanks: 0
Thanked 3 Times in 3 Posts
Send a message via MSN to surendran Send a message via Yahoo to surendran
Default

hi,
i didn't understand your requirment properlly, anyway check following code may help you

$con = mysql_connect("localhost","root","root");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("studentreg", $con);
$name=$_REQUEST["name"];
mysql_query ( "DELETE FROM particulars WHERE name='$name' ");
echo "name deleted!!";
mysql_close($con)
__________________
surendran
(Anything is Possible)
http://www.suren.info
http://ssuren.spaces.msn.com





Similar Threads
Thread Thread Starter Forum Replies Last Post
need help updating and deleting!!!!!!!!!!!!!!! samXR Beginning PHP 1 May 29th, 2009 04:46 PM
need help updating and deleting!!!!!!!!!!!!!!! samXR SQL Language 2 May 22nd, 2009 02:50 AM
need help updating and deleting!!!!!!!!!!!!!!! samXR MySQL 0 May 21st, 2009 09:08 PM
Updating/Deleting from SQL using ASP Tee88 Classic ASP Databases 4 May 6th, 2005 11:14 AM
updating and deleting record PinkyCat Classic ASP Databases 4 March 16th, 2005 05:50 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.