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
Post a Comment