acctman Posted September 2, 2008 Share Posted September 2, 2008 I added a while function to process all rows for m_addtn field in the rate_mem table but, nothing is happening. I'm not getting any errors or anything. $res = mysql_query("SELECT m_addtn FROM rate_mem"); //$res = mysql_query("SELECT m_addtn FROM rate_mem WHERE m_id = '39'"); //$results = mysql_fetch_array($res,MYSQL_BOTH); while($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/122317-while-function-help/ Share on other sites More sharing options...
kenrbnsn Posted September 2, 2008 Share Posted September 2, 2008 Put an "or die" clause on the queries: <?php $q = "SELECT m_addtn FROM rate_mem"; $res = mysql_query($q) or die("Problem with the query: $q<br>" . mysql_error()); ?> and <?php $q = "UPDATE rate_members SET m_orientation = '$m_orientation', m_status = '$m_status', m_turn_on = '$m_turn_on', m_turn_off = '$m_turn_off' "; mysql_query ($q) or die("Problem with the query: $q<br>" . mysql_error()); ?> and see if you get any errors. Ken Link to comment https://forums.phpfreaks.com/topic/122317-while-function-help/#findComment-631609 Share on other sites More sharing options...
acctman Posted September 2, 2008 Author Share Posted September 2, 2008 Put an "or die" clause on the queries: <?php $q = "SELECT m_addtn FROM rate_mem"; $res = mysql_query($q) or die("Problem with the query: $q<br>" . mysql_error()); ?> and <?php $q = "UPDATE rate_members SET m_orientation = '$m_orientation', m_status = '$m_status', m_turn_on = '$m_turn_on', m_turn_off = '$m_turn_off' "; mysql_query ($q) or die("Problem with the query: $q<br>" . mysql_error()); ?> and see if you get any errors. Ken ok its process now, but its not each row by itself. It should grab row 1 decode m_addtn then update, then go to row2 and do the same. Link to comment https://forums.phpfreaks.com/topic/122317-while-function-help/#findComment-631626 Share on other sites More sharing options...
acctman Posted September 2, 2008 Author Share Posted September 2, 2008 any idea on whats wrong with my while function? is there more coding that is needed to get it to work Link to comment https://forums.phpfreaks.com/topic/122317-while-function-help/#findComment-631850 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.