shikra Posted June 14, 2010 Share Posted June 14, 2010 $sql_coupon_expire = "SELECT * FROM tbl_coupon"; $itm = '[email protected]; $aj = '[email protected]'; $coupon_res = executeQuery($sql_coupon_expire); while($row=mysql_fetch_assoc($coupon_res)){ $coupon_update = "UPDATE tbl_coupon SET email = '".($email =($email == $aj)? $itm:$aj)."'"; echo $coupon_update."<br />"; executeQuery($coupon_update); } The echo output of the query is just fine i.e alternative email is selected but database is updated with only one value... any explanation why? Link to comment https://forums.phpfreaks.com/topic/204693-short-form-of-if-else-does-not-update-database-correctly/ Share on other sites More sharing options...
shikra Posted June 14, 2010 Author Share Posted June 14, 2010 $sql_coupon_expire = "SELECT * FROM tbl_coupon"; $itm = '[email protected]; $aj = '[email protected]'; $coupon_res = executeQuery($sql_coupon_expire); while($row=mysql_fetch_assoc($coupon_res)){ $coupon_update = "UPDATE tbl_coupon SET email = '".($email =($email == $aj)? $itm:$aj)."'"; echo $coupon_update."<br />"; executeQuery($coupon_update); } The echo output of the query is just fine i.e alternative email is selected but database is updated with only one value... any explanation why? need to include the where clause for it to work as desired Link to comment https://forums.phpfreaks.com/topic/204693-short-form-of-if-else-does-not-update-database-correctly/#findComment-1071724 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.