Jump to content

Using Foreach/Loop on a query


acctman

Recommended Posts

Hi, the current code I wrote below looks up one user ID (m_id = 39) and processes it, how would I process all rows in table rate_mem?

 


$res = mysql_query("SELECT m_addtn FROM rate_mem WHERE m_id = '39'");
$results = mysql_fetch_array($res,MYSQL_BOTH);

$decode = unserialize(base64_decode($results['m_addtn']));

$m_orientation = 	$decode['3'];
$m_status = 	$decode['6'];
$m_turn_on = 	$decode['4'];
$m_turn_off = 	$decode['1'];

mysql_query ("UPDATE rate_members SET
             m_orientation = '$m_orientation',
             m_status = '$m_status',
             m_turn_on = '$m_turn_on',
             m_turn_off = '$m_turn_off'
             WHERE m_id = '39'");

Link to comment
https://forums.phpfreaks.com/topic/122263-using-foreachloop-on-a-query/
Share on other sites

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.