web_master Posted July 8, 2008 Share Posted July 8, 2008 hi, I have a 12 (if) errors. How can I do to put posted variables in dbase only if all the error are 0? <?php if( $_POST['something'] ) { $error[1] == 1; } else { $error[1] == 0; } if( $_POST['something2'] ) { $error[2] == 1; } else { $error[2] == 0; } if( $_POST['something3'] ) { $error[3] == 1; } else { $error[3] == 0; } if(all the errors are equal zero) { $query = mysql_query("INSERT INTO `table` ( ... } ?> Quote Link to comment Share on other sites More sharing options...
vbnullchar Posted July 8, 2008 Share Posted July 8, 2008 try this.. <?php if(array_sum($error)==0) { ... } ?> Quote Link to comment Share on other sites More sharing options...
tibberous Posted July 8, 2008 Share Posted July 8, 2008 if(!count($errors)) $query = mysql_query("INSERT INTO `table` ( ... Quote Link to comment Share on other sites More sharing options...
web_master Posted July 8, 2008 Author Share Posted July 8, 2008 try this.. <?php if(array_sum($error)==0) { ... } ?> this is working, THNX!!!!!! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.