[Help] Replace MySQL error message

In insert form, I want to post a especial error message, instead of mysql_error
here an example:
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "insert_form")) {
  $insertSQL = sprintf("INSERT INTO stuff (title, numbers) VALUES (%s, %s)",
                       GetSQLValueString($_POST['titla'], "text"),
                       GetSQLValueString($_POST['numbers'], "int") );
  mysql_select_db($database_connection, $connection);
  $Result1 = mysql_query($insertSQL, $connection) or die(mysql_error());
cause i get an error like cannot be null
Thanks.
[Subject line edited by moderator to make it more meaningful]

If you want to replace the MySQL error message, you can put your own error message in quotes in the die() command. Change this:
$Result1 = mysql_query($insertSQL, $connection) or die(mysql_error());
to this:
$Result1 = mysql_query($insertSQL, $connection) or die('Database error');
However, that's not very helpful to a user, because all that will be displayed is "Database error" with no indication of what caused the error or any way of returning to the page, except by using the browser back button.
A better way of handling things is to remove the or die(mysql_error()) section of code altogether and replace it with a PHP conditional statement that sends the user to an error page if the SQL fails for any reason. However, making these changes will prevent you from making further edits to the server behavior through the Server Behaviors panel.
$Result1 = mysql_query($insertSQL, $connection);
if (!$Result1) {
  $insertGoTo = 'error.php';
} else {
  $insertGoTo = 'another_page.php' // <-- this is the original $insertGoTo line

Similar Messages

  • TS1368 I cannot sync my iTunes library to my iphone 5 can you help I get error message connection could not be established to iPhone

    I cannot sync my iTunes library to my iphone5 can you help I get error message a connection could not be established to the iPhone

    Yes it is.
    Initially I got an error message saying can't connect because of Date & Time settings.
    Went in and re-verified that those were correct.
    Tried to update downloads and then got a new error message: "Can't connect to iTunes Store".
    I live in the US and that's where I created my iTunes a/d and Apple ID.
    I am currently in India --- can that coause confusion re date & time?

  • Help with the error message that ADE is not allowed to copy a book onto my Nook. I have tried authorizing and unauthorizing many times--at wits end with this issue.

    Help with the error message that ADE is not allowed to copy a book onto my Nook. I have tried authorizing and unauthorizing many times--at wits end with this issue.

    I too am having the same problem. I have a new hard drive that was imaged from the old one and I'm trying to side load a book to my Nook Simple Touch.. I first installed ADE 4 then borrowed and downloaded a book from Overdrive. I tried a few times to delete and reauthorize both the computer and the Nook and each time I get an authorization error when I try to side load the book. I then found on the Nook forum that the Simple Touch and ADE 4 don't get along. So I uninstalled ADE 4 and installed ADE 3.
    I then followed this recommended procedure found on the forum: I deleted the Digital Editions folder from my Nook, launched ADE 3 and authorized the computer, then connected the Nook. For a few seconds, hovering the mouse over the setting icon for the Nook displayed everything on the context menu grayed out. But then it showed the context menu and I was able to display the Nook's authorization, which was the same as the computer's. Still get the same error side loading the book. Deleting and reauthorizing doesn't help.  And the Digital Editions folder is still missing from the Nook.

  • Help-syncing mail error message

    I got the following error message while syncing my iPhone 3G to my Mac-
    *iTunes could not sync mail accounts to the iPhone “Paul’s iPhone because an error occurred remapping record identifiers.*
    +Try syncing your iPhone again. If the problem persists, replace the mail accounts on the iPhone from the info tab in the iPhone preferences.+
    I sync my me.com through mobile me and I also have a gmail imap and a comcast pop 3 account. I deleted all the accounts from the iPhone. The error message still kept coming up. I restored my iPhone and it was fine for 4 days. Now I'm getting the error message again.
    Any ideas?
    I appreciate your help!

    Not sure how to resolve this, but after you have transferred the email account settings from your computer to your iPhone via the iTunes sync process which is selected under the Info tab for your iPhone sync preferences, you don't need to keep this option selected under the Info tab for your iPhone sync preferences. This only needs to be done once and is a one way transfer process only - from your computer to your iPhone.

  • Please help with custom error messages

    Hello,
    I am trying to display my own error messages for the <f:validate_required /> validation.
    Here is what I tried:
    -in my faces config xml file, I have:
    <message-resources>
    <message-resources-id>myResourceID</message-resources-id>
    <message>
    <message-id>javax.faces.validator.RequiredValidator.FAILED_MESSSAGE_ID</message-id>
    <summary xml:lang="en">No name was entered</summary>
    </message>
    </message-resources>
    -in the jsp page, I have:
    <h:input_text id="name" valueRef="person.name" >
    <f:validate_required />
    </h:input_text>
    (below:)
    <h:output_errors id="myResourceID" for="name"/>
    It is not displaying my custom error message ("no name was entered") but the default error messages.
    Please help!!
    Juju

    Unfortunately, the current version of the reference implementation does not pick up replacement messages from <message-resources> elements yet. This will be corrected prior to the next release.
    Once that is done, the original proposal will work if one change is made -- all of the standard validators pick up their messages from a standard message resources identifier, so you will need to change to:
    <message-resources-id>
    javax.faces.context.FACES_API_MESSAGES
    </message-resources-id>
    instead of your own message resources identifier.
    Craig

  • Help with an error message: This edit cannot be done...

    "This edit cannot be done because a transition would be cut or an item to one side of a transition would become too short."
    Can someone please help me understand this one? I have a project with self made lower thirds from a .tif graphic on V2 and a text track on V3. Each track has a 15 frame Edge Wipe on both ends. Within the sequence I have no problem either drag copying both tracks together or even copy/pasting them further down the sequence.
    The error pops up when I try to copy/paste to a different sequence. Regardless of whether I try to paste it above my video on V1 or past the video's end I still get that error message.
    If I delete the transitions, I can copy/paste just fine and re-add them, but it's so frustrating. I really just want to understand what's going on here. Could someone explain this in layman's terms?
    Edit: I should also add that if I Option-Click the Toggle Auto Select for track two, I can paste just fine. Which might lead me to believe that it's trying to paste to track V1 where video is already laid down, except that even if I try to paste after the video it still won't work. If I'm copying track V2 and V3, shouldn't paste automatically past to V2 and V3?
    Message was edited by: The Bundok

    I had this problem before. I like to disable extra services to speed up my computer and I disabled the Apple Mobile Device service and had to re-enable this.
    You can do that by going Control Panel>Administrative Tools>Services. Once you have gone to the services window, look for Apple Mobile Device and right-click. Select "Properties". There should be some information about the service as well as the label "Startup Type" with a drop-down menu beside it. If it says "disabled", that is your problem; Change the selection to anything except disabled (Automatic is easier and ensures that you can sync as soon as itunes opens).
    If this doesn't work, I would look into your anti-virus' settings. Good Luck!

  • Help on printing error messages to a log file

    Hi, may I know whether is there any way to print the error messages to a log file? Thanks for your help!

    noobboy,
    Please refrain from crossposting all of your questions into multiple forums. You were asked to stop this the last time you did this as well. Please be more considerate in future.

  • After Upgrade to latest iTunes, it will not open.Uninstall and reinstall did not help Getting this error message ''  Runtime Error R6034 '' An application has made an attempt to load the C runtime library incorrectly''. 3 windows PCs.1 vista, 2 windows7 7

        I upgraded to the latest iTunes 11.1.4, after a prompt from the iTunes store. But will not open after the upgrade. One of three error messages told me to reinstall. I did. Restarted and scanned.  But no help there. So I unistalled and re installed from Apples' website. The installation was okay as usual but still will not open. Keep getting the same error messages. '' Runtime Error R6034, ''  '' An application has made an attempt to load the C runtime library incorrectly. Please contact the application's support team for more information.''  That's the error messages I get when I try to open the New installed iTunes 11.1.4. Right now there is no iTunes on any of my PCs. Installed but will not open. Please Help.Thanks.
    Jonas.
    3 Windows PCs. Safari 5.1.5 ( One Laptop with Vista. Two Windows 7 64 bit on All in One Sony desktop PCs. )

    Try the following user tip:
    Troubleshooting issues with iTunes for Windows updates

  • Looking for some help with an error message when exporting master file. I'm stuck and would even pay to get this sorted out!

    Hey guys, I'm really in a bind here and need some urgent help tonite. I would even be willing to pay for some actual help and not some vague information that i may not be able to understand if we could do something via skype or some other way that would be much quicker than a message board. Of course I have to have the project done by tomorow . so I'm new to fcpx, but have succesfully exported 2 other projects. I've also ran into this predicament before (error message not allowing me complete export) and have been able to solve that by converting the files i imported off my camera (canon g20) to a different file type (prores).
    so where I'm at now: i have a 13 min short, all shot on my canon g20, imported and converted to prores422 with the brorsoft video converter with all the shots in a single event in fcpx. i'm using fcpx version 10.0.08. I have one main video track in my timeline that is completely full of very fast edits. (all quick 2-5 second clips, sped up shots in 2x, 4x, or 8x, tons of transitions, titles, and a little fx. theres 2 audio tracks, one is narration/speech and the other is an ongoing music track that constantly ducks everytime the subject speaks (tons of ducks/edits). Have you seen mtv cribs? Well i filmed an EXACT replica. So If you've seen one of those episodes, its literally the same exact same thing. I have all of my work completed, everything has been fully rendered, and i have it exactly as I want it.
    I'm including all this information in case it may help. my successful projects ive exported in the past were rather simple, and this one is very complex and full of edits. here is what it looks like in the timeline:
    Ive tried exporting the master file using almost all the different ways with no luck. My primary objective is to get it on youtube by any means by tommorow for a showing to a potential buyer (long story) and so I've been told using the h.264 is the best format for that. This, along with the other methods give me the same error message:
    It think it gives this error message when i reach 24% everytime during export.
    So first of all, what is that error message? Do i need to be concerned about the specifics of it, or is there something major that I'm missing? Like i said, i dont care how, but I need to get this video up on youtube tonite for an important viewing tomorrow. Conceptually, I think if i can figure this one out I shouldnt have any more trouble in the future doing something so basic, yet critical, such as exporting my 40+ hours of work for someone to see.
    anyway, I apologize in advance for my lack of knowledge with this software, and for my extremely long winded question which will probably have the opposite effect for me as most wont want to take the time to read all this, BUT i figured if i was as thorough as possible it might help actually getting a concrete answer, instead of a "read the manual, exporting is on page 37." or "use the share button on the right of the timeline then just click export master file and it will work everytime."
    Cheers everybody, and thank you. Like i said if someone is up, and willing to talk via skype, phone, messanger or any other method that works for you I would be totally down and will compensate you generously for your time. thanks again.
    Taphabit

    boom! that advice was correct and worked. i was able to export the full project as a quicktime movie and it can be uploaded to youtube.
    NOTE, theres is definately quite a few noticeable audio glitches/lags/pops that werent there before doing this. I believe, and will test to make sure, that having a project such as this one needs to render before exporting. I'm not sure if the advice requires the project to be unrendered before exporting for a specific reason, because if it will export fine after rendering the project that's the way to go. like i said the edited version i have in my timeline plays back perfectly but this exported version has quite a few noticeable audio glitches (a few video glitches too). I'm going to retry doing the first few steps of your advice, but then at the end render, then export and compare the results...
    OK, so this leads to a big question, Is this something that is standard for everyone when trying to export? If its not, what causes this error?
    is there any way of preemptively avoiding it in future projects?
    thanks again, and hopefully this information will help others as exporting seem to be one of the biggest problems in fcpx. any word on a new patch or firmware update?

  • Need help in displaying error message on the same screen

    Hi Experts,
    I have written a report which gets called from IW52 by clicking one of the action items. Now in my report when I am trying display an error message it is getting displayed at the bottom of a blank screen. My requirement is to display it at the bottom of the IW52 screen, so that user can rectify the error.
    Please help.
    Regards,
    Sambaran Ray.

    Hi,
    Probably you need to find a way to enhance the standard code.
    But make one thing sure that the code (included bu you) gets fired only when that specific report is being executed. Else it may harm the standard functionality.
    Hope this helps you.
    Regards,
    Tarun

  • Help with my error message

    this is my second iPOD with the same error message. "Attempting to copy to the disk "CYNDIEBRAY" failed. The disk could not be read from or written to."
    can someone help me use my iPOD.. the genius desk just exchanged my other on. i have a new 80GB and it hasn't been used yet.

    Maybe you're right, if this is the second one to have this exact problem. It is probably the computer if you aren't up to date. If your operating system is outdated, or your computer needs updates, such as a USB update. Also you might have some damaged music or photo files, that are causing this error. Your hard drive could be damaged in your computer or ipod that would cause problems also.
    I once got a similar message, it always happend while updating when i got to a certain song. I deleted that song, and then it worked again. I'll keep looking around for solutions to that error message though.

  • TS3694 I need help to fix error message -69

    I am having problem with syncing my ipod classic (160gb). I have this error message -69, that I need help with. I have already restored my ipod, but cannot add my anything (audiobooks-my music) to my ipod.

    see if you have any friend have a Mac computer, do a restore there before syncing with your PC

  • Apple Help Center Menu Error Message

    This is about the "Help Center".  When I click on it from an application or from the Finder, I get an error message "The selected topic is currently unavaliable.  Make sure you're connected to the Internet.  For help connecting ..."  etc.  This happens when I AM connected to the internet.  It may or may not bring up a menu with topics, but if I have that and click a topic, I get this message.  So in order to get help I have to come in through the Apple Support website directly.  Am I missing something?  Is there a setting I should be enabling somewhere?

    Thiis is a general fix for not being able to view help menu topics, I don't know if it will work in your case because I'm not familiar with the alret you are getting but it can't hurt to try as these are only cache files.
    From your "Go" menu choose "Go to Folder" then enter ~/Library/Caches
    Delete these items
    com.apple.helpd
    com.apple.helpviewer
    Log out and back in or restart.
    It may be a bit slower the first time until the cache catches up.

  • Help and support error message

    when I try and use the help and support icon on my HP pavillion windows vista computer, I get the following error message:Microsoft script host Script: C:\Windows\Help\OEM\scripts\openOEMACW.jse line: 2 Char:1 error: Automation server can't Create Object  Code: 800A01AD Source: Microsoft JScript runtime error

    Hello sportsfan888,
    Here is another thread with a similar issue that banhien was able to find a solution.
    G71-340US HP Help and Support Problems
    It would appear that the Help and Support application needs to be reinstalled.
    If I have helped you in any way click the Kudos button to say Thanks.
    The community works together, click Accept as Solution on the post that solves your issue for other members of the community to benefit from the solution.
    - Friendship is magical.

  • Can anyone help me with Error Message 3036??

    I tried to contact tech support about this. Well, that was a dead end. They told me I had a firewall that was blocking the downloads to resume and sending up an error message, but no cigar, because guess what?? I don't have Firewalls!!! Anyone older, wiser, and more experienced out there (aka tech wizards) to help a poor lost soul out?? Basically, I open iTunes and notice that there's downloads available to send to my PC, then I click the 'resume download' button, and the error message "Unable to check for downloads. An unknown error occured (3036)." pops up. I thought if the error was unknown, they wouldn't know that it was "Error 3036", but apparently 'Unknown' doesn't mean unknown anymore. Please, please help me!!

    The reply option won't let me paste the diagnostics how do I get them to come up?
    Message was edited by: on my last nerve Microsoft Windows XP Home Edition Service Pack 3 (Build 2600)
    Acer AOA150
    iTunes 10.3.1.55
    QuickTime 7.6.9
    FairPlay 1.11.17
    Apple Application Support 1.5.2
    iPod Updater Library 10.0d2
    CD Driver 2.2.0.1
    CD Driver DLL 2.1.1.1
    Apple Mobile Device 3.4.1.2
    Apple Mobile Device Driver 1.57.0.0
    Bonjour 2.0.5.0 (214.3)
    Gracenote SDK 1.8.2.457
    Gracenote MusicID 1.8.2.89
    Gracenote Submit 1.8.2.123
    Gracenote DSP 1.8.2.34
    iTunes Serial Number 0012AB70128D2830
    Current user is an administrator.
    The current local date and time is 2011-06-30 16:10:55.
    iTunes is not running in safe mode.
    WebKit accelerated compositing is enabled.
    HDCP is not supported.
    Core Media is not supported. (16005)
    Video Display Information
    Mobile Intel(R) 945 Express Chipset Family
    Mobile Intel(R) 945 Express Chipset Family
    **** External Plug-ins Information ****
    No external plug-ins installed.
    Genius ID: 767245d30071f5e9a3671e5feda75ae5
    iPodService 10.3.1.55 is currently running.
    iTunesHelper 10.3.1.55 is currently running.
    Apple Mobile Device service 3.3.0.0 is currently running.
    **** Network Connectivity Tests ****
    Network Adapter Information
    Adapter Name:     {1E46F9E6-D2E7-4609-953E-75BE74221BD0}
    Description:     Atheros AR5007EG Wireless Network Adapter - Packet Scheduler Miniport
    IP Address:     192.168.0.5
    Subnet Mask:     255.255.255.0
    Default Gateway:     192.168.0.1
    DHCP Enabled:     Yes
    DHCP Server:     192.168.0.1
    Lease Obtained:     Thu Jun 30 15:43:49 2011
    Lease Expires:     Fri Jul 01 15:43:49 2011
    DNS Servers:     192.168.0.1
              205.171.3.25
    Adapter Name:     {3084DBB3-5F60-4037-8361-F5013CCDDEFE}
    Description:     Realtek RTL8102E/RTL8103E Family PCI-E Fast Ethernet NIC - Packet Scheduler Miniport
    IP Address:     0.0.0.0
    Subnet Mask:     0.0.0.0
    Default Gateway:     
    DHCP Enabled:     Yes
    DHCP Server:     192.168.0.1
    Lease Obtained:     Sun Jan 16 10:42:36 2011
    Lease Expires:     Mon Jan 17 10:42:36 2011
    DNS Servers:     
    Active Connection:     LAN Connection
    Connected:     Yes
    Online:          Yes
    Using Modem:     No
    Using LAN:     Yes
    Using Proxy:     No
    SSL 3.0 Support:     Enabled
    TLS 1.0 Support:     Enabled
    Firewall Information
    Windows Firewall is on.
    iTunes is enabled in Windows Firewall.
    Connection attempt to Apple web site was successful.
    Connection attempt to browsing iTunes Store was successful.
    Connection attempt to purchasing from iTunes Store was successful.
    Connection attempt to iPhone activation server was successful.
    Connection attempt to firmware update server was successful.
    Connection attempt to Gracenote server was successful.
    Last successful iTunes Store access was 2011-06-30 15:48:44.

Maybe you are looking for

  • WiSM, unable to see Interface after adding.

    We have an up and running WiSM, for about 9 months.  It resides in a 6509 chassis. I needed to add a new interface for another subnet (previous one was getting over ran, and we have a new project) I went through the process of adding the interface. 

  • Not letting me do anything in store!

    Sorry if this is long but, itunes isnt letting me buy any music, its been fine up until today I forgot my password so had to request a new one which was fine but then it asks me to sign in to change billing details which is understandable as i got a

  • How to invoke Speaker Sound from Forms 6i

    Hai friends I want to give some alert sound from the Builtin computer speaker. In Visual Basic we can make like Chr(7) How can i accomplish this in Forms6i. Pls reply. I use BELL builtin it is not working.

  • RTP stream being stripped

    How can I check to see if 802.1Q VLAN tagging information is being stripped from the RTP stream by the workstation's NIC?

  • How to autostart database when OS reboot?

    Hi, Each time when my OS reboot, login to the SQL*Plus showing connect to idle instance, I have to restart database manually by enter startup command. The ORA_SID_AUTOSTART value already set as TRUE in the regedit. What else do I miss? Thanks.