I’m making a form to update users in my database using PHP and MySQL Improved. Could someone give me an example of displaying an “Update Successful” message after the form is submitted, and the update is successful?
@Joseph_WitchardauthorOct 23.2008 — #Umm, not exactly what I was looking for:o I know how to send people to different pages. What I need is to know how to display a message if the update was successful, as in nothing in the PHP or SQL messed up during execution. Sorry for the confusion.
@ayveghOct 23.2008 — #The most obvious thing (IMHO) would be to check the boolean return value (i.e. true / false) from the query execution statement.
Example: [code=php]// do the connecting stuff (this example uses MySQL) $success = mysql_query("UPDATE ... ", $connection);
if ($success == true) { // redirect to the "success page", or just print or echo right here } else { // something went wrong - take appropriate action (display error page, email admin, save log, dump environment, etc.) }[/code]
@Joseph_WitchardauthorOct 23.2008 — #The most obvious thing (IMHO) would be to check the boolean return value (i.e. true / false) from the query execution statement.
Example: [code=php]// do the connecting stuff (this example uses MySQL) $success = mysql_query("UPDATE ... ", $connection);
if ($success == true) { // redirect to the "success page", or just print or echo right here } else { // something went wrong - take appropriate action (display error page, email admin, save log, dump environment, etc.) }[/code][/QUOTE]
That's the type of thing I was looking for? Thanks everyone!