[Help] Replace the MySQL error message

In the form of the insert, I want to put a special, instead of mysql_error error message

Here is an example:

If ((isset($_POST["MM_insert"])) & & ($_POST ["MM_insert"] == "insert_form")) {}
$insertSQL = sprintf ("INSERT INTO stuff (title, number) 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

Thank you.

[Subject line edited by moderator to make it more explicit]

If you want to replace the MySQL error message, you can put your own error in quotes in the die() command. Change this:

$Result1 = mysql_query($insertSQL, $connection) or die(mysql_error());

to do this:

$Result1 = mysql_query($insertSQL, $connection) or die('Database error');

However, it is not very useful for a user, because all that appears is "Database error" with no indication of what caused the error or sort of a return to the page, except using the browser back button.

A better way of handling things is to remove the or of the article die (mysql_error ()) code altogether and replace it with a PHP conditional statement that returns the user to an error page if the SQL code fails for some reason any. However, these changes will prevent you to make other changes to the server through the server behaviors panel behavior.

$Result1 = mysql_query($insertSQL, $connection);

if (!$Result1) {
  $insertGoTo = 'error.php';
} else {
  $insertGoTo = 'another_page.php' // <-- this is the original $insertGoTo line
}

Tags: Dreamweaver

Similar Questions

  • Replace the default error message

    Hello

    In many places, I get an error message that resembles "attribute {0} in {1} is required." where {0} = {1} = name of the Application module and attribute name and name of vo. Attribute e.g. in AppAM.Person name is necessary.

    In this case for the required fields for EO and are not very friendly.

    I would like to replace this default message to something more friendly without making changes to each OS in my application.

    I tried to create a resource group and replace the text for entry fields:

    org.apache.myfaces.trinidad.UIXEditableValue.REQUIRED = The fields is required.

    org.apache.myfaces.trinidad.UIXEditableValue.REQUIRED_detail = Please enter a value.

    However the required OS message always appears and only the message of required component is changed.

    Moreover I also watched http://www.adftutorials.com/adf-custom-error-handler-to-display-custom-message-to-user.html where a custom error handler is added to the databinding.cpx file. However, my request is composed of multiple workspaces different AMs including all use the same model of the OT all / vo and adding handlers for all workspaces does not seem like the right solution.

    How can I replace these EO / AM messages by default?

    With the help of Jdev 12.1.2.0.0

    TIA

    OK in this case, you must go with the error handler custom as you say.

    and you just need to save customErrorHandler class to all your databinding.cpx file.

  • After replacing the disk error message hard says product not correct ket

    We have replaced the hard drive from the laptop, when put on - it asks us to click on windows xp prof, what we do

    He invites us to enter the product key for the bottom of the laptop - what we do - and we were told that the product key is not valid

    Help!

    Not to be confused with letters and numbers. Examples: Letter B to the number 8, letter O with the number 0.  Also Q with O.

    How to activate Windows XP
    http://support.Microsoft.com/kb/307890/en-us

    How to contact a Microsoft Product Activation Center:
    http://support.Microsoft.com/default.aspx/KB/950929/en=us

    Microsoft Activation centers worldwide telephone numbers:
    http://www.Microsoft.com/licensing/existing-customers/activation-centers.aspx
    (This site is for activating Volume License, but if you call, they will help you)

    The phone number is not working:
    Microsoft Wordwide contacts: http://www.microsoft.com/worldwide/default.aspx

    Users of Windows XP - Genuine Advantage Notifications:
    http://www.Microsoft.com/downloads/en/details.aspx?displaylang=en&FamilyID=afd45b36-3d77-4259-801c-d31a9a90cdcf
    (This tool will confirm that the copy of Windows installed on your PC is genuine and authorized)

    J W Stuart: Http://www.pagestart.com

  • After you download El Capitan, I received the following error message when you try to install: the drive is not formatted in MAC OS extended (journaled). Use disk utility to enable logging or reformat the disc. Can anyone help?

    After you download El Capitan, I received the following error message when you try to install: the drive is not formatted in MAC OS extended (journaled). Use disk utility to enable logging or reformat the disc. Can anyone help? (My disk utility shows that she in MAC OS extended (journaled) format.)

    It shows that it is Mac OS extended, not journaled. Click enable logging in the toolbar.

    The thing you read is if you format the drive using the RAID settings you have selected. You have to look at the bottom of the window where it shows the Format.

  • There was a problem creating the destination folder. If please check the permission of folder or choose a different folder.   What that means, tried to name several different folders, but still the same error message. Would be grateful for the help!

    There was a problem creating the destination folder. If please check the permission of folder or choose a different folder.   What that means, tried to name several different folders, but still the same error message. Would be grateful for the help!

    This means that the folder you want to create is blocked because of file permissions. The drive or folder you are trying to create the destination folder is set to read-only, and your username does not have write permissions.

  • I get an error message of complete storage - please backup and remove your something online (can not see the full error message) when converting PDF reader to point rower inacrobat DC. Help, please

    I get an error message of complete storage - please backup and remove your something online (can not see the full error message) when converting PDF reader to point rower inacrobat DC. Help, please

    Hi debg25514049,

    You will not be able to export your PDF to PPT using the service Adobe export in PDF format.

    You'll need subscription to pack Adobe PDF or the Acrobat application to convert PDF to PPT.

    Kind regards
    Nicos

  • I have the following error message when you try to access the settings preferences "load library failed with error 1114: (DLL) initialization routine failed. I use Windows OS 10. Can anyone help?

    I have the following error message when you try to access the settings preferences "load library failed with error 1114: (DLL) initialization routine failed. I use Windows OS 10. Can anyone help?

    HI lifeimagecreations

    Greetings!

    Please see this thread in the lightroom preferences entry CC2015 crashes with LoadLibrary failed with error 1114

    If this does not work, reinstall the program with administrative rights.

    Let us know if this helps

    Concerning

    ~ Assani

  • CS6 on Windows 7, when I try and send my project Adobe Link, then I still repeatedly get the error message "still has stopped working, windows closes the program.  I get the same error message when I try and open again on its own.  Help Woo

    Also when I open again as a standalone program, and when I try and export my work via Adobe link to send to again, I get the same error message - "Adobe Encore has stopped working.  Windows will close the program.  Help would be really appreciated.  Thank you.

    Run 'as administrator' If your account has administrator privileges or not.

    Let us know if that suits him.

  • CC of Dreamweaver generates one of the 3 error messages when you use find and replace on 8.1 Win 64 bit.

    CC of Dreamweaver generates one of the 3 error messages when you use find and replace is used more than twice in a row. "While executing onLoad in bc_afterSave.htm, the following JavaScript error occurred: at line 188 of file C:\Program Files (x 86) \Adobe|. Adobe DreamweaverCC | Configuration | Shared | ' BC\JS\bc_sites.js': out of memory.

    or

    When executing RunCommand in File_Save.htm, a JavaScript erroroccurred.

    or

    While exciting getDynamicContent inAdressURL.htm, an erroroccirred of Javascript.

    Any thought - I find myself CBWMS of closing and reopening. Will work for the other two find and replace once again before the popup of messaged\s error.

    Cough, cough, cough - 38 500 pages? !  Really?  It's a big site!

    I'm not surprised, that you are short of memory.  Try to limit your F & R records or select files rather than the entire Site.

    Nancy O.

  • Clone error: warning: could not replace the variables for message ADX RC-50004

    Hello

    We are cloning 11.5.10.2 Prod environment in the DEV environment.
    The structure is as follows:
    Node 1: DB + competitor Manager
    Node 2: Application Apache (forms and reports)

    We run the adcfgclone.pl successfully on the nodes of the db and apache
    We received the following error message when it is applied on the concurrent Manager node

    ERROR: creation of context not completed successfully

    Check the log file and found the following:
    Database utility - ADX finished-

    WARNING: Could not replace the variables for message ADX RC-50004


    StackTrace:
    java.lang.NullPointerException
    to oracle.apps.ad.tools.configuration.CVMHelper.getDBInitParameters)
    Compiled code)
    at oracle.apps.ad.tools.configuration.CVMHelper.getDBName (Compiled C
    ODE)
    at oracle.apps.ad.context.CloneContext.setDatabaseName (Compiled Code
    )
    at oracle.apps.ad.context.CloneContext.doClone (Compiled Code)
    at oracle.apps.ad.context.CloneContext.main (Compiled Code)


    Unsuccessful creation of context files



    Also, we checked the alert log database (9.2.0.7) and found the following error:
    ORA-00600: internal error code, arguments: [ttcgcshnd-1], [0], [], [], [],]
    ], [], []


    We follow action plans in the notes:
    Note 726509.1
    Note 304037.1

    Again, we have the same error and can not clone concurrent Manager node.

    Enjoy a quick answer because we are in the middle of the execution of the project.

    Thank you

    Salvation;

    Check Please Note: run perl./adcfgclone.pl appsTier ORA-00600: internal error code, arguments: [ttcgcshnd-1] [263298.1 ID]

    It may be useful

    Respect of
    HELIOS

  • Error message: Adobe Reader has stopped working properly.  Windows will close the program and notify you if a solution is available.  I uninstalled the drive program and reinstalled the drive program.  The same error message appears.  Help

    Someone has an answer to the above error message?

    Can you open Reader by itself?  If so, try to disable the Protected Mode [Edit |] Preferences | (Improved) security].

  • How stop "low on ink to the printer" error message on ipad

    HP Officejet 5470 continues to send a low on ink error message to my IPad. I don't know my printer settings to disable these messagets, help!

    You won't find any printer or the printer settings. AirPrint is a diffuse wifi printing system, so that these messages are actually sent by your printer and simply displayed on your iPad.  Stop messages, to bad draw on the printer itself.  If it is low on ink, then replace cartridges.  If this is not the case, check the printer manual or online support on erasing the incorrect error messages or status.

  • PHP/MySql error message

    I posted this before and didn't get the answer I need, probably because I didn't post all my codes. I use PHP/MySql.  I created a Web site that has several forms.  When I conducted three of the forms, I get the below error messages:

    You have an error in your SQL syntax; consult the manual for your version of the MySQL server for the right syntax to use near ' condition, length, color, city, 'State', Email, Photo) VALUES ('29 ', ' 4',' used "in line 1.)

    I write the codes below.  I hope this time that I posted everything I should have so that I can get help.

    FORM

    < form action = "<?" PHP echo $editFormAction;? ">" method = "POST" enctype = "multipart/form-data" name = "individual" class = 'individual' id 'individual' = >
    < table width = "594" border = "0" class = "test" >
    < tr > < /tr >
    < b >
    < td width = "166" class = 'td' > view < table > title
    < td colspan = "3" > < span id = "sprytextfield1" >
    < label >
    < input name = "Display title" type = "text" class = "test" id = "Display title" size = "35" / >
    < / label >
    < span class = "textfieldRequiredMsg" > required </span > < / span > < table >
    < /tr >
    < b >
    < td = 'td' class > price < table >
    < td colspan = "3" > < span id = "sprytextfield2" >
    < label >
    < input name = "price" type = "text" class = 'test' id = 'price' size = '35' / >
    < / label >
    < span class = "textfieldInvalidFormatMsg" > Invalid format. </span > < / span > < table >
    < /tr >
    < b >
    < class td = 'td' > < table > format
    < td colspan = "3" > < label >
    < select name = "size" = "1" multiple = "multiple" class = 'test' id = 'size' >
    < option > 0 < / option >
    < option > 2 < / option >
    < option > 4 < / option >
    < option > 6 < / option >
    < option > 8 < / option >
    < option > 10 < / option >
    < option > 12 < / option >
    < option > 14 < / option >
    < option > 16 < / option >
    < option > 18 < / option >
    < option > 20 < / option >
    < option > 22 < / option >
    < option > 24 < / option >
    < option > 26 < / option >
    < / select >
    < / label > < table >
    < /tr >
    < b >
    < class td 'td' = > status < table >
    < td colspan = "3" > < label >
    < select name = "Condition" class = 'test' id = 'State' >
    < option > new < / option >
    < option > used < / option >
    < / select >
    < / label > < table >
    < /tr >
    < b >
    < class td 'td' = > length < table >
    < td colspan = "3" > < label >
    < select name = "Length" class = 'test' id = 'Length' >
    Long < option > < / option >
    Short < option > < / option >
    < option > mid-length < / option >
    < / select >
    < / label > < table >
    < /tr >
    < b >
    < class td 'td' = > color < table >
    < td colspan = "3" class = 'td' > < span id = "sprytextfield5" >
    < label >
    < input name = "Color" type = "text" class = "test" id = "Color" size = "35" / >
    < / label >
    < span class = "textfieldRequiredMsg" > required </span > < / span > < table >
    < /tr >
    < b >
    < class td 'td' = > city < table >
    < class td = 'td' > < span id = "sprytextfield4" >
    < label >
    < input name = "City" type = "text" class = 'test' id = 'City' size = "35" / >
    < / label >
    < span class = "textfieldRequiredMsg" > required </span > < / span > < table >
    < class td = 'td' > < table >
    < class td = 'td' > < table >
    < /tr >
    < b >
    < class td 'td' = > status < table >
    < td colspan = "3" > < label >
    < select name = "State" class = 'test' id = 'State' >
    < option > AL < / option >
    < option > AK < / option >
    < option > AZ < / option >
    < option > AR < / option >
    < option > CA < / option >
    < option > CO < / option >
    < option > CT < / option >
    < option > OF < / option >
    < option > DC < / option >
    < option > FL < / option >
    < option > GA < / option >
    < option > HI < / option >
    ID < option > < / option >
    < option > HE < / option >
    IN < option > < / option >
    < option > HERE < / option >
    < option > KS < / option >
    < option > KY < / option >
    < option > THE < / option >
    < option > ME < / option >
    < option > MD < / option >
    < option > MY < / option >
    < option > e < / option >
    < option > MN < / option >
    < option > MS < / option >
    < option > MO < / option >
    < option > MT < / option >
    < option > NOT < / option >
    < option > NV < / option >
    < option > NH < / option >
    < option > NJ < / option >
    < option > NM < / option >
    < option > NY < / option >
    < option > NC < / option >
    < option > ND < / option >
    < option > OH < / option >
    < option > OK < / option >
    < option > OR < / option >
    < option > PA < / option >
    < option > LAUGHED < / option >
    < option > SC < / option >
    < option > SD < / option >
    < option > TN < / option >
    < option > TX < / option >
    < option > c < / option >
    < option > VT < / option >
    < OPTION > < / option >
    < option > WA < / option >
    < option > WV < / option >
    < option > WI < / option >
    < option > WY < / option >
    < / select >
    < / label > < table >
    < /tr >
    < b >
    < class td 'td' = > Email < table >
    < td colspan = "3" > < span id = "sprytextfield3" >
    < label >
    < input name = "Email" type = "text" class = "test" id = "Email" size = "35" / >
    < / label >
    < span class = "textfieldRequiredMsg" > required </span > < span class = "textfieldInvalidFormatMsg" > Invalid format. </span > < / span > < table >
    < /tr >
    < b >
    < height = "26" td class = 'td' > confirm Email < table >
    < td colspan = "3" > < span id = "spryconfirm1" >
    < label >
    < input name = "Confirm Email2" type = "text" class = 'test' id = 'confirm Email2"size ="35"/ >
    < / label >
    < span class = "confirmRequiredMsg" > required </span > < span class = "confirmInvalidMsg" > the values don't match. </span > < / span > < table >
    < /tr >
    < b >
    < height td = '26' class = 'td' > photo (s) < table >
    < td colspan = "3" > < label >
    < input name = "Photo" type = 'file' class = 'test' id = 'Photo' size = "35" / >
    < / label > < table >
    < /tr >
    < b >
    < height = '131' td class = 'td' > < table > Details
    < td colspan = "3" > < label >
    < textarea = cols "Additional Details" name = "40" lines "6" = class = 'test' id = "Détails" > < / textarea >
    < / label > < table >
    < /tr >
    < /table >
    < p >
    < label >
    < input name = "Submit" type = 'submit' class = 'test' id = "Submit" value = "Post" / >
    < / label >
    < /p >
    < input type = "hidden" name = "MM_insert" value = "individual" / >
    < / make >

    SERVER BEHAVIOR


    If (! function_exists ("GetSQLValueString")) {}
    function GetSQLValueString ($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
    {
    If (via PHP_VERSION < 6) {}
    $theValue = get_magic_quotes_gpc()? stripslashes ($TheValue): $theValue;
    }

    $theValue = function_exists ("mysql_real_escape_string")? mysql_real_escape_string ($TheValue): mysql_escape_string ($theValue);

    Switch ($theType) {}
    case 'text ':
    $theValue = ($theValue! = "")? « " ». $theValue. "" "": "NULL";
    break;
    case "long":
    case "int":
    $theValue = ($theValue! = "")? intval ($TheValue): 'NULL ';
    break;
    case "double":
    $theValue = ($theValue! = "")? doubleVal ($TheValue): 'NULL ';
    break;
    case "date":
    $theValue = ($theValue! = "")? « " ». $theValue. "" "": "NULL";
    break;
    case "set":
    $theValue = ($theValue! = "")? $theDefinedValue: $theNotDefinedValue;
    break;
    }
    Return $theValue;
    }
    }

    $editFormAction = $_SERVER ['PHP_SELF'];
    If (isset {}
    $editFormAction. = « ? ». htmlentities($_SERVER['QUERY_STRING']);
    }

    If ((isset($_POST["MM_insert"])) & & ($_POST ["MM_insert"] == "individual")) {}
    $insertSQL = sprintf ("INSERT INTO donations (postingTitle, 'size', condition, length, color, city, 'State', email, photo) VALUES (%s, %s %s, %s, %s, %s, %s, %s, %s)", ")
    GetSQLValueString ($_POST ["'validation title"], "text").
    GetSQLValueString ($_POST ['size'], "text").
    GetSQLValueString ($_POST ["State"], "text").
    GetSQLValueString ($_POST ['Length'], "text").
    GetSQLValueString ($_POST ['Color'], "text").
    GetSQLValueString ($_POST ['city'], "text").
    GetSQLValueString ($_POST ["State"], "text").
    GetSQLValueString ($_POST ['Email'], "text").
    GetSQLValueString ($_POST ['Photo'], "text"));

    @mysql_select_db ($database_bridesmaidsrack_db, $bridesmaidsrack_db);
    $Result1 = mysql_query ($insertSQL, $bridesmaidsrack_db) or die (mysql_error ());

    $insertGoTo = "donations.php";
    If (isset {}
    $insertGoTo. = (strpos ($insertGoTo, '?'))? « & » : « ? » ;
    $insertGoTo. = $_SERVER ['QUERY_STRING'];
    }
    header (sprintf ("location: %s", $insertGoTo));
    }

    CONNECTION TO THE BASE


    # FileName = "Connection_php_mysql.htm"
    # Type = 'MYSQL '.
    # HTTP = 'true '.
    $hostname_bridesmaidsrack_db = "localhost";
    $database_bridesmaidsrack_db = "bridesmaidsrack";
    $username_bridesmaidsrack_db = "";
    $password_bridesmaidsrack_db = "";
    $bridesmaidsrack_db = mysql_pconnect ($hostname_bridesmaidsrack_db, $username_bridesmaidsrack_db, $password_bridesmaidsrack_db) or trigger_error (mysql_error (), E_USER_ERROR);

    OK, so your initial problem was the condition of the word, because it is a reserved word for MySQL.

    Here is a list of the reserved words.

    http://dev.MySQL.com/doc/refman/5.1/en/reserved-words.html

    If you use a reserved word, you must place the accents around it like this...

    "condition."

    then MySQL knows you use it as a standard Word and he interprets not as command.

    OK now on the following problem.

    'Photo' column cannot be null

    When you have created your table in MySQL tells you that the photo field can not be empty. If you are forcing people to add a photo, then you need to do the checked field before the script runs / inserts. If you're ok with them NOT to add a photo, then you have to allow NULL values for this field in your table. This is a function that you would normally control via PHP MyAdmin or other MySQL database management software.

    Now, the last question:

    The Dynamic (form.action...) attribute is just how the FIELD itself will appear in SB (Server Behaivors) who is not the insertion of a plug.

    Record insertion as I said probably disappeared because some how you two when you shouldn't have one. So when we removed a DW (Dreamweaver) now think his party but is not. This can sometimes be corrected by opening the page again and closing or manually set or remove all SB side code, and then add the insertion of a plug anywhere. But at least you know what was the original problem so you can fix it after add it again.

  • photos has not been loaded for weeks (usually the browser chrome on PC windows at work).  I tried now on some other computers and get the same error message and I report every time.  can I do or just wait for someone to fix it

    photos has not been loaded for weeks (usually the browser chrome on PC windows at work).  I tried now on some other computers and get the same error message and I report every time.  is there anything I can do or just wait for someone to fix it?

    If you want any help here, you'll have to tell us what the error message.

    Which report you errors to?

  • Since the change of Tiscali to TalkTalk if I click on links in the emails read on webmail, I get the following error message and then I get disconnected from your

    Since the change of Tiscali to TalkTalk if I click on links in the emails read on webmail, I get the following error message and then I disconnected from TalkTalk webmail.

    HTTP status 404 - /cp/templates/applications/mail/html/null.jsp type status report

    message /cp/templates/applications/mail/html/null.jsp

    Description the requested resource (/ cp/templates/applications/mail/html/null.jsp) is not available. Apache Tomcat/5.5.27

    can you help
    

    Please contact the webmaster. The webmaster will then contact us if they need our help. Thank you!

Maybe you are looking for