doubledee Posted December 25, 2011 Share Posted December 25, 2011 How can I make my INSERT query *fail* so that I can test this code... // Verify Insert. if (mysqli_stmt_affected_rows($stmt)==1){ // Insert Succeeded. // Set Message. $_SESSION['resultsCode'] = 'ACCOUNT_MEMBER_ACCT_CREATED'; $_SESSION['registrationEmail'] = $email; }else{ // Insert Failed. $_SESSION['resultsCode'] = 'ACCOUNT_MEMBER_ACCT_FAILED'; }// End of VERIFY INSERT. Thanks, Debbie Quote Link to comment Share on other sites More sharing options...
premiso Posted December 25, 2011 Share Posted December 25, 2011 It depends on how you want it to fail. There is the SQL SYNTAX, which you could just change INSERT to something different. Or there is a violation of some type of restraint, such as a duplicate id on a primary key field, a non-unique item on a unique field etc. With what you have given, it is impossible for us to guide you without knowing how you want to fail and seeing the relevant sql structure / code. Quote Link to comment Share on other sites More sharing options...
doubledee Posted December 25, 2011 Author Share Posted December 25, 2011 It depends on how you want it to fail. There is the SQL SYNTAX, which you could just change INSERT to something different. Or there is a violation of some type of restraint, such as a duplicate id on a primary key field, a non-unique item on a unique field etc. With what you have given, it is impossible for us to guide you without knowing how you want to fail and seeing the relevant sql structure / code. I want the IF-THEN-ELSE above to fail on an INSERT. What additional code do you need to see? I just have a standard INSERT query in a standard Prepared Statement, so I thought what I provided was enough?! Debbie Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted December 26, 2011 Share Posted December 26, 2011 add an extra quote at the end of the query. 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.