|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Multiple queries in one statement
I maintain a database of member names for our organization, and use php to maintain that database for such things as adding a member, updating a member, and deleting a member.
The problem is with delete member. For example, if I have two members with the last name of Smith, my query results page displays both of them, with a delete option for each. However, if I click the delete button for John Smith, Mike Smith is also deleted. How do I set my query so that only the selected member is deleted? The current query for that is: $query="DELETE FROM members WHERE lastname='$lastname'"; |
|
#2
|
|||
|
|||
|
about delete
As u said u have two members with Smith as lastname but first name differs,
So u can write the query like Query=DELETE FROM members WHERE firstname LIKE 'John%' (John Smith) or 'Mike%'(Mike Smith); or else u can use '=' operator instead of LIKE operator in ur query. Hope it will be useful. |
|
#3
|
|||
|
|||
|
about delete
If u want to delete the records only using lastname.....the following reply won't work.If not it will.......
As u said u have two members with Smith as lastname but first name differs, So u can write the query like Query=DELETE FROM members WHERE firstname LIKE 'John%' (John Smith) or 'Mike%'(Mike Smith); or else u can use '=' operator instead of LIKE operator in ur query. Hope it will be useful. |
![]() |
| Viewing: Dev Articles Community Forums > Databases > MySQL Development > Multiple queries in one statement |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|