/    Sign up×
Community /Pin to ProfileBookmark

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?

to post a comment
PHP

5 Comments(s)

Copy linkTweet thisAlerts:
@bourkey08Oct 23.2008 — redirect user to another page using [code=php]
<?php
header("location: success.php");
?>
[/code]
Copy linkTweet thisAlerts:
@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.
Copy linkTweet thisAlerts:
@bourkey08Oct 23.2008 — [code=html]
<script language='javascript'>
window.alert("Update Successful");
</script>
[/code]


is this what you mean?
Copy linkTweet thisAlerts:
@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]
Copy linkTweet thisAlerts:
@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!
×

Success!

Help @Joseph_Witchard spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...