Hello,
I'm trying to get the result values from one mysql query, and use them in another query but I can't figure out how to do this with arrays.
I have this query which gets the records that I would like to DELETE:
<?php
mysql_select_db($database_Serials, $Serials);
$query_rs_selectdelete = "SELECT serial_id, serial_username, serial_warning FROM serials WHERE serial_username = 'bigbob'";
$rs_selectdelete = mysql_query($query_rs_selectdelete, $Serials) or die(mysql_error());
$row_rs_selectdelete = mysql_fetch_assoc($rs_selectdelete);
$totalRows_rs_selectdelete = mysql_num_rows($rs_selectdelete);
?>
Now I want to get all the values of "serial_warning"(this field holds id's which correspond to records in another table) from the first query and DELETE them in the second query like this:
DELETE FROM `warnings` WHERE `warning_id` IN (142,156,168)
How to a get a comma separated string of values like 142,156,168 from serial_warning in the first query and stick it in the second query? I know I should use arrays some how but I can't figure it out.
Thanks for any help,
Peter