Jump to content

[SOLVED] does mysql_query($query); always have to be followed by or die(mysql_error());


Recommended Posts

hi, I am having problem with this, I wish to have my own error message instead of "or  die(mysql_error());" because my users dont understand those mysql messages. But it doesnt work if you dont put them there after mysql_query($query);... so is there a way to show my own error message instead of mysql error messages?
Thanks
Ted
If you want more flexibility, you can write it like this:

[code=php:0]$result = mysql_query($sql);
if ($result === false) {
  print "The query to fetch widget ids from the database failed!  Please try again in a few minutes, or send an email to admin@example.com if problems persist.  Thankyou for your patience.\n";
  # Do whatever else you want to do..
  exit(0);
}[/code]
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.