php - Update table if other table update is successful -


how can update table2 in below code if updation in table1 success?

$sql="update table1 set col1='abc' col2='1'"; $result=mysql_query($sql); if(that success) {     $sql="update table2 set col1='cde' col2='1'";     $result=mysql_query($sql); } 

see mysql_affected_rows() function, return number of rows updated. also, try avoid using mysql_* functions in favor of mysqli_* or pdo, deprecated.


Comments

Popular posts from this blog

node.js - Bad Request - node js ajax post -

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -