Error in SQL syntax when inserting data to the table in the form of values using insert record

Hello

I was hoping that someone could help me.  I am creating a form of registration on a website to insert data into a database table.  When you try to create the form, I get the following error:


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 ' VALUES (name, regno, reason) leave (has ', 1, 'dddd')' at line 1

I checked the syntax, but you don't know what's wrong.

I am running Windows 7 with Dw cs6 and wamp server.

Leave with the names of column (name, regno, reason) is the name of the table.

Thank you for your help and please help me.

The code is as below:

<? php require_once('Connections/connect.php');? >

<? PHP

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"] == "form1")) {}

$insertSQL = sprintf ("INSERT INTO leave (name, regno, reason) VALUES (%s, %s, %s)',

GetSQLValueString ($_POST ['name'], "text").

GetSQLValueString ($_POST ['reg'], "int").

GetSQLValueString ($_POST ['reason'], "text"));

@mysql_select_db ($database_connect, $connect);

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

}

? >

< ! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict / / IN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" > ""

" < html xmlns =" http://www.w3.org/1999/xhtml ">

< head >

< meta http-equiv = "content-type" content = text/html"; charset = utf-8 "/ >"

< title > online form let < /title >

< name meta = "keywords" content = "" / > "

< name meta = "description" content = "" / > "

< link href = "styless.css" rel = "stylesheet" type = "text/css" media = "screen" / > "

< / head >

< body >

< div id = 'wrapper' >

< div id = "header" >

< div id = 'menu' >

< ul >

< class li = "current_page_item" > < a href = "#" > home < /a > < /li >

< li > < /li >

< li > < /li >

< li > < a href = "#" > on < /a > < /li >

< li > < /li >

< li > < a href = "#" > Contact < /a > < /li >

< /ul >

< / div >

<!-end #menu->

< div id = "Search" >

< / div >

<!-end #search->

< / div >

<!-end #header->

< div id = "logo" >

E - SCHOOL of CHRIST < h1 > < / h1 >

< p > < / p >

< / div >

< hr / >

<!-end #logo->

<! - end #header - wrapper->

< div id = "page" >

< div id = "content" >

< div class = "post" >

< h2 class = "title" > leave application online < / h2 >

< div class = "entry" > < / div >

< / div >

< do action = "<?" PHP echo $editFormAction;? ">" method = "POST" name = "form1" id = "form1" >

< table width = "200" border = "2" cellspacing = "5" cellpadding = "5" >

< b >

< scope th 'row' = > name < /th >

< td > < label for = "name" > < / label >

< input type = "text" name = "name" id = "name" / > < table >

< /tr >

< b >

< scope = "row" th > Reg No. < /th >

< td > < label for = "reg" > < / label >

< input type = "text" name = "reg" id = "reg" / > < table >

< /tr >

< b >

< scope = "row" th > why < /th >

< td > < label for = "reason" > < / label >

< name textarea = 'reason' id = cols 'reason' = "45" rows = "5" > < / textarea > < table >

< /tr >

< b >

< scope = "row" th > < /th >

< td > < input type = "submit" name = "b1" id = "b1" value = "Submit" / > < table >

< /tr >

< /table >

< input type = "hidden" name = "MM_insert" value = "form1" / >

< / make >

< / div >

<!-end #content->

< div id = "sidebar" >

< ul >

< li >

Notice of < h2 > < / h2 >

< p > students must present the appropriate documents supporting the reason for leave within 3 working days. < /p >

< /li >

< li id = "calendar" >

Calendar < h2 > < / h2 >

< div id = "calendar_wrap" >

< table summary = "Calendar" >

< caption >

March 2014

< / legend >

< thead >

< b >

< th abbr = "Monday" scope = "col" title = "Monday" > M < /th >

< th abbr = "Tuesday" scope = "col" title = "Tuesday" > T < /th >

< th abbr = "Wednesday" scope = "col" title = "Wednesday" > W < /th >

< th abbr = "Thursday" scope = "col" title = 'Thursday' > T < /th >

< th abbr = "Friday" scope = "col" title = 'Friday' > F < /th >

< th abbr = "Saturday" scope = "col" title = 'Saturday' > S < /th >

< th abbr = "Sunday" scope = "col" title = 'Sunday' > S < /th >

< /tr >

< / thead >

< tfoot >

< b >

< td abbr = "February" colspan = "3" id = "prev" > < a href = "#" title = "" > & laquo; Feb < /a > < table >

< class td = "pad" > < table >

< td abbr = "April" colspan = "3" id = "next" > < a href = "#" title = "" > Apr & raquo; < /a > < table >

< /tr >

< / tfoot >

< tbody >

< b >

< td colspan = "5" class = "pad" > < table >

< td > < table > 1

< td > < table > 2

< /tr >

< b >

< td > 3 < table >

< td > < table > 4

< td > 5 < table >

< td > < table > 6

< td > < table > 7

< td > < table > 8

< td > < table > 9

< /tr >

< b >

< td > < table > 10

< td id = 'today' > < table > 11

< td > < table > 12

< td > < table > 13

< td > < table > 14

< td > < table > 15

< td > < table > 16

< /tr >

< b >

< td > < table > 17

< td > < table > 18

< td > < table > 19

< td > < table > 20

< td > < table > 21

< td > < table > 22

< td > < table > 23

< /tr >

< b >

< td > < table > 24

< td > < table > 25

< td > < table > 26

< td > < table > 27

< td > < table > 28

< td > < table > 29

< td > < table > 30

< /tr >

< b >

< td > < table > 31

< class td = "pad" colspan = "6" > < table >

< /tr >

< / tbody >

< /table >

< / div >

< /li >

< li > < /li >

< /ul >

< / div >

<!-end #sidebar->

< div style = "" clear: both; "> < / div >"

< / div >

<!-end #page->

< div id = "footer" >

< p > Copyright (c) University of Christ. All rights reserved. < /p >

< / div >

<!-end #footer->

< / div >

< div align = center > < / div > < / body >

< / html >

The LEAVE is a reserved word in MySQL. You can try to quote, but you are better to rename it.

Tags: Dreamweaver

Similar Questions

  • Display data in the form of values separated by commas - need help

    Hi all

    I have some data formatted in the way below. The ID of the drug are the primary keys of the table and the first 9 digits in the drug ID are the same. They can be separated based on the last two digits.

    Type of drug drug ID
    00603107554 respiratory
    00603107556 cough and cold
    Antitussive-00603107558


    I want that data to be formatted as
    Type of drug drug ID
    006031075 respiratory, cough and colds, Antitussive

    I want to cut the last two characters, and format data. And the types must be displayed in the form of values separated by commas. Can someone help me?

    Thanks in advance

    Rambeau
    WITH t AS (SELECT '00603107554' Drug_ID, 'Respiratory' Drug_Type FROM DUAL
               UNION
               SELECT '00603107556', 'Cough and Cold' FROM DUAL
               UNION
               SELECT '00603107558', 'Antitussive' FROM DUAL)
        SELECT Drug_id, SUBSTR (SYS_CONNECT_BY_PATH (Drug_Type, ','), 2) Drug_Types
          FROM (SELECT SUBSTR (drug_id, 1, LENGTH (drug_id) - 2) drug_id,
                       Drug_Type,
                       ROW_NUMBER ()
                       OVER (PARTITION BY SUBSTR (drug_id, 1, LENGTH (drug_id) - 2)
                             ORDER BY Drug_Type)
                          rn
                  FROM t)
         WHERE CONNECT_BY_ISLEAF = 1
    START WITH rn = 1
    CONNECT BY PRIOR rn = rn - 1 AND PRIOR drug_id = drug_id
    
    DRUG_ID     DRUG_TYPES
    006031075     Antitussive,Cough and Cold,Respiratory
    

    just a note, I wonder if blushadow could consider adding techniques agg string to its very useful faq section because it seems a good
    request.

    Published by: pollywog on April 14, 2011 06:42

    Published by: pollywog on April 14, 2011 06:43

  • Error in SQL syntax when creating record insertion form

    Nice day

    I was hoping that someone could help me.  I am creating a form of registration on a website to insert data into a database table.  When you try to create the form, I get the following error:

    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 ' organization, office, phone, EmailAddress, JobTitle, 'OfficialMaili' at line 1

    Do not know what is happening.  I am running windows 8 and cs5 DW w / MYSQL.  I'm testing on a local server before pushing to the remote server.

    I thank you for your help and please indicate any code you want to send me.


    M.I.,

    "OfficialMailing address".

    The table names, column names, etc. must not contain punctuation, space or special characters. Difficulty of these column names, and then try again.

  • Error message States 'A TCP/IP error occurred while trying to send data to the Server Error 0x800ccc13' when try to open Microsoft Outlook 2000.

    Original title: Office of Microsoft Outlook 2000 does not open.

    Error message States "A TCP/IP error occurred while trying to send data to the Server Error 0x800ccc13 #

    Hi John,.

    1. what operating system is installed on your computer?

    2 How long have you been faced with this problem?

    3. don't you make changes on your computer before this problem?


    Reference:
    Outlook 2000 Solution Center

    Please post back and we do know.

  • ORA-01843: not a valid month - no dates on the form

    When I submit a form I get the error "ORA-01843: not one month valid." I've now removed all the date of the form fields, and there is no triggers or constraints on the table concerning the date fields, so I'm at a loss on how to solve this problem. Any help much appreciated.

    Edited by: Waggers April 11, 2012 03:38

    in lspq? a default value? in a select with to_date?

  • Selection of the date on the forms online

    Hello. I have a Xperia z5 compact Marshmallow. When you enter a date on the forms online (Chrome), a calendar just for me to choose a date of. I have to scroll through each month for the previous dates. This means enter my birth date takes an eternity that I have to scroll every month to the year 1990. Is there a faster way to do this? Thank you.

    I finally (accidentally) figured this out. If I click on the year he allows me to scroll directly to the year I want

  • Message from blackBerry Smartphones: the page you requested was created using data from the form.

    While closing a link to expedia.ca a message come to say: the page you requested was created using data from the form. This page is no longer available.  If you resend the data, any action that has been specified by the form will be repeated.  You want to resubmit the data?  When I click Yes or no, nothing happens except that the message just reappears.  I can't get rid of it so I can't do anything else on my phone, except to answer a call if someone calls me.  How can I get rid of this message from my phone?  I tried to turn it works... even by leaving off the coast for 5 minutes before turning turn it back on.  I can't even check my OS because I do not what anyone on my phone.  I hope someone can help me with this.

    Have you tried a battery pull?  This should fix a problem as you described.

    With your phone, remove the battery, then replace a minute later.  This will do all sorts of wonderful things to your phone for free unclaimed memory, delete no cited source points and make your phone run smoothly.

    Try it and let us know if it does the trick.

  • Send a reminder using the Dates of the form

    Hi all.

    I don't know what is the best way to send reminders (email), verification of the dates of the form.

    For example:

    There is a task assignment when the user enters 5 dates (day 1, day 2, day 2... etc)

    Then I need to send emails to 'Xpath user' when the date system is: "day 1" - 24 hours (for example). "."  The same date 2, day 3... etc.

    How can I do?

    I write the dates in the database need?

    Some ideas?

    Thank you very much.

    Maria

    You can use a gateway with a branch for each email that will be sent. Put a holding Point before sending email. Set days to wait as an XPath expression using get-days-from-dateTime-difference(current-date (), Date of the form). Subtract 1 for your less 24 hours.

  • Earlier today, I registered on a different account. When I registered in the account that I use or music from apple, none of this was there. I do I get my apple music?

    Earlier today, I registered to a different Apple ID account in iTunes. When I registered in the account that I use or music from apple, none of this was there. I do I get my apple music?

    Your Apple's music is only available at the account Apple ID was purchased from.

  • ActiveX in BradySoft (CodeSoft) - what method/class/object I would use to send data to the form variable to BradySoft?

    Can what method/class/object I use to send data to the form variable to BradySoft? I have a basic configuration of BradySoft label and I want to send it data of variable shape (a serial number) from Labview ActiveX. I joined guide Brady ActiveX programmers, but can't understand what to use for that.

    P.S. I would call Brady or TekLynx tech support on this issue, but they have a strict policy while BradySoft supports ActiveX, but does not provide technical support assistance programming with it. I thought I would try the Forums OR.

    Just an update. I could get this to work myself after a few days of playing with it (I suppose that the best way to learn!). I have attached a sample VI for anyone interested. Can we Kudo ourselves?

  • call a stored procedure for each row in the transitional attribute and display the data in the form of af: table. The other rows are based on the entities

    Hi Experts,

    JDeveloper 12.1.3.0.0

    I have a VO based on entity object. With a column of the VO is transient attribute (I created).

    I need to call a stored procedure for each row in the transitional attribute and display the data in the form of af: table. As well as other attributes.

    So can anyone suggest how can I achieve this?

    Thank you

    AR

    I think that you need a stored function (which returns the value) in this case, is not?

    Take a look at:

    https://docs.Oracle.com/CD/B31017_01/Web.1013/b25947/bcadvgen005.htm

    and search for:

    Invoking stored function with only Arguments in

    call your function in the Get attribute and return value accessor...

  • On the forms send us and receive in return, data in the form of fields will be not print.  We can view the data, but the fields to print Virgin.  How can I fix it?

    On the forms send us and receive in return, data in the form of fields will be not print.  We can view the data, but the fields to print Virgin.  How can I fix it?

    OK, it's different. These text boxes are (at least engineering point of view) not considered form data, they are annotations (or markup). On your print dialogue box, you will see a group of "Comments & Form". Make sure that the first control is set to "Document and annotations:

    After this change, you should see the markup of your impressions.

  • How I changed the color of something? OK, so I use to be able to change the color of things, but now I have use color overlay, gradient overlay, or change the color when I first create the form, it turns into another shade of gray instead of chan

    How I changed the color of something? OK, so I use to be able to change the color of things, but now I have use color overlay, gradient overlay, or change the color when I first create the form, it turns into another shade of gray instead of change the color, I chose.

    Three things I can think of:

    Your document must be in RGB mode.

    Layer blending mode should be set to Normal

    Masks are grayscale. If you select the mask, you cannot apply a color.

    Always check your tab at the top to see if what you choose is RGB or grayscale.

    Gene

  • the data in the form has expired

    I have this program:
    Altas.cfm '...
    < cfform format = "flash" action = "decide.cfm" >
    ....""
    in the program decide.cfm «...»
    < cfinput type = "button" label = "Back" onclick = "< javascript > histoy.go(-1) < / javascript >" >
    ..."

    in this moment I return to the altas.cfm form, but in the screen show this message
    "The form data has expired, please reload this page in your browser. How to avoid this message, how can reload this page form automatically?

    I have the solution:

    Add the option timeout = "10", where 10 is the second that the form contains values, variables and forms in the form tag.

    the solution is:

  • print the data of the form instead of the whole page

    Hi all

    I'm having a problem in my ADF/JSF page. I just want to print the data in the form of my form instead of the whole page.using javascript:print() method prints the whole page. so can you help me solve this problem. I JDev 10.1.3 and do not want to upgrade to 11g JDev!

    Is there a java code to do?

    Thank you

    Hello

    You can apply CSS to the page and use the media to deermine switch which components will appear in print and who should not.

    Download the word document in http://thepeninsulasedge.com/frank_nimphius/wp-content/uploads/2008/05/OldAndLostBlogBusterTips.zip

    and take a look at page 287

    Frank

Maybe you are looking for