Shalini Shalini - 3 years ago 157
PHP Question

how to run update query for all values fetch by previous query

I want to run an sql select query which fetches P_no and after that an update query is run for it. It always update only 1 value.

$qu="select P_no from date_summary where `Nextcall_1`='$d' or
`Nextcall_2`='$d' or `Nextcall_3`='$d' or `Nextcall_4`='$d'
or`Nextcall_5`='$d' or `Nextcall_6`='$d' or `Nextcall_7`='$d' or
`Nextcall_8`='$d' or `Nextcall_9`='$d' or `Nextcall_10`='$d' or
if($res && mysqli_num_rows($res)>0)
$qu="update notification_status set Noti_status='Unchecked' where

Answer Source

You could use the in operator:

UPDATE notification_status
SET    noti_status='Unchecked'
WHERE  p_no IN (SELECT p_no FROM date_summary WHERE /* etc... */)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download