Jump to content

using PHP to delete rows in a database


kevincro

Recommended Posts

If I have a database table that has three columns.  They are named user_name, number, user_id.  Lets say that the values in 8 seperate rows are as follows:

  • joe  85 7
  • bill  85 10
  • Dave  83 22
  • Sue  85 3
  • Andy  85 5
  • Susan  83 13
  • Jim  85 9
  • Kenneth  83 16

 

My question is, how do I construct a query in PHP/MySQL that will delete only the first entry with the number column value of 83.  In this case that would be Dave.

Thanks

Kevin

Link to comment
https://forums.phpfreaks.com/topic/97247-using-php-to-delete-rows-in-a-database/
Share on other sites

what i meant was that even if you insert one record before another, you can't be sure that the first one you inserted will be the first one deleted. don't think of a (at least MySQL) table as a stack of records. it's more like a random jumble; if you don't specify a record, you never know what you'll get.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.