在echod php之后删除mysql数据

I want to delete MySQL database data after it is echod once. I will not include all of my code since it worked fine there is no point in checking that part.

$db = 'SELECT blah1, blah2, blah3 FROM dbtest LIMIT 1';

Then after echoing everything out I tried to delete it using

$sql = "DELETE FROM dbtest WHERE id='one of the row names go here?'";

I'm not sure how to do this. In my database I have Email, Password and that's it. What would go in place of the id=?

Extract a unique field e.g id for the one echoed and pass it to the query

// Say the last echoed entry has the id : $id, then

$sql = "DELETE FROM dbtest WHERE id=$id"

Imagine that you have a table named as users and it has the fileds id, email and name.

$dataUser=mysql_query("select id,email,name From users LIMIT 1");
$result=mysql_fetch_array($dataUser);

echo $result['name'].' / '.$result['email'];

//Now lets delete:
if(mysql_query("DELETE FROM users WHERE id='".$result['id']."'"))
       echo 'row was deleted';

Now you can change id for email if it is the only field that you have as unique or index. But if you don't have an id field, I encourage you to create one, set it as index and auto increment. I hope this can help you.

Since you only have the two fields in your table you would use the following:

$sql = "DELETE FROM `dbtest` WHERE `id` = '$emailAddress' LIMIT 1";

But...you need to make sure you check $emailAddress before blindly using it in a query, especially one that deletes data.