www.webdeveloper.com
Results 1 to 6 of 6

Thread: Successful Update?

  1. #1
    Join Date
    Dec 2007
    Location
    Mississippi
    Posts
    1,063

    Successful Update?

    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?

  2. #2
    Join Date
    Oct 2008
    Posts
    25
    redirect user to another page using
    PHP Code:
    <?php
    header
    ("location: success.php");
    ?>

  3. #3
    Join Date
    Dec 2007
    Location
    Mississippi
    Posts
    1,063
    Umm, not exactly what I was looking for 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.

  4. #4
    Join Date
    Oct 2008
    Posts
    25
    HTML Code:
    <script language='javascript'>
    window.alert("Update Successful");
    </script>
    is this what you mean?

  5. #5
    Join Date
    Jun 2008
    Location
    Right Behind You
    Posts
    215
    The most obvious thing (IMHO) would be to check the boolean return value (i.e. true / false) from the query execution statement.

    Example:
    PHP Code:
    // 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.)


  6. #6
    Join Date
    Dec 2007
    Location
    Mississippi
    Posts
    1,063
    Quote Originally Posted by ayvegh View Post
    The most obvious thing (IMHO) would be to check the boolean return value (i.e. true / false) from the query execution statement.

    Example:
    PHP Code:
    // 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.)

    That's the type of thing I was looking for Thanks everyone!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles