Re: how to modify in the db
| From: | Miles Thompson | Date: | Sun, 06 Jul 2003 20:08:24 +0000 |
| Subject: | Re: how to modify in the db | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-154143@lists.php.net to get a copy of this message | ||
Start with a good tutorial on PHP and MySQL - there are scads of them around, and Julie Meloni has some excellent examples at www.thickbook.com.
At 04:41 PM 7/6/2003 -0300, Kevin Fradkin wrote:
hi... i have this secuence to insert data to my db mysql_query ("INSERT INTO my_table( number,name,surname ) values ('$number','$name','$surname' )"); i want to ask what do i have to do if i want to modify instead of insert when this data already exists... for example.. i have in my_table number name surnameUse a SELECT query to find if it exists (mysql_numrows() - check sp.) then issue an UPDATE query to change it, making certain you have a unique key to identify the record. otherwise, use your INSERT query. This stuff isn't magic - you have to do a bit of work to get the desired results.1 jhon smithand i want to change the name...jhon --> john
and if that not exist create it... number name surname0 mary duke 1 charles emmersonand add john's one.. ( to check if i can use only modify to add ) thnx!.. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php