Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

form feed to mysql db table using d.mx

  • 23-09-2003 12:03pm
    #1
    Closed Accounts Posts: 2,393 ✭✭✭


    I have setup a connection from a html form to a database table (mysql).

    Table setup with the following sql statement:

    CREATE TABLE Brochure_Request (Requester_ID INT NOT NULL PRIMARY KEY AUTO_INCREMENT, ****_checkbox ENUM('Y','N') DEFAULT 'N', *****_checkbox ENUM('Y','N') DEFAULT 'N', First_name VARCHAR(20) NOT NULL, Last_name VARCHAR(30) NOT NULL, Address VARCHAR(50), Phone_no INT NOT NULL, Email VARCHAR(20));


    HTML FORM FIELDS:

    ****_checkbox
    *****_checkbox
    First_name (textfield - singleline)
    Last_name (textfield - singleline)
    Address (textfield - multiline)
    Phone_no (integer)
    Email (textfield - singleline)


    Using the Dreamweaver interface, selected insert records under database - selected the Brochure_Request table from the list, matched each field with the equivalent form field - click ok and that should be it.

    On submit, the fields are validated to make sure their all filled out and with the right data type.

    However, on testing it, no data is dropping in to the table??

    Any ideas as to what might be going on here?


Comments

  • Closed Accounts Posts: 40 lucian


    where is the Insert statement?

    Can you post a copy of the page, will be helpful.

    You could try this forum for more help:

    WroxP2P


  • Closed Accounts Posts: 2,393 ✭✭✭Eurorunner


    cant paste the full page but this is a snippet with the insert statement:
    if ((isset($HTTP_POST_VARS["MM_insert"])) && ($HTTP_POST_VARS["MM_insert"] == "Brochure_requests")) {
    $insertSQL = sprintf("INSERT INTO Brochure_Request (****_checkbox, *****_checkbox, First_name, Last_name, Address, Phone_no, Email) VALUES (%s, %s, %s, %s, %s, %s)",
    GetSQLValueString(isset($HTTP_POST_VARS) ? "true" : "", "defined","'Y'","'N'"),
    GetSQLValueString($HTTP_POST_VARS) ? "true" : "", "defined","'Y'","'N'"),
    GetSQLValueString($HTTP_POST_VARS, "text"),
    GetSQLValueString($HTTP_POST_VARS, "text"),
    GetSQLValueString($HTTP_POST_VARS, "text"),
    GetSQLValueString($HTTP_POST_VARS, "int"),
    GetSQLValueString($HTTP_POST_VARS, "text"));

    mysql_select_db($database_DB_CONN, $DB_CONN);
    $Result1 = mysql_query($insertSQL, $DB_CONN) or die(mysql_error());

    mysql_select_db($database_DB_CONN, $DB_CONN);
    $Result1 = mysql_query($insertSQL, $DB_CONN) or die(mysql_error());


    My fudging around with the codes getting me into deeper bullcrap...now getting this error for the form page:

    Parse error: parse error, unexpected ',' in /xxxx/xxxx/xxxx/xxxxxx/request_brochure.php on line 36

    where line 36 =
    GetSQLValueString($HTTP_POST_VARS) ? "true" : "", "defined","'Y'","'N'"),

    Its exactly the same as the line before it so wheres the problem?


  • Closed Accounts Posts: 40 lucian


    ?


    I am sorry, i never worked with MySQL.
    I use SQL2000 database. try the link I gave you above.
    Imar will help you with it.


  • Closed Accounts Posts: 2,393 ✭✭✭Eurorunner


    Thanks for the link..will check it out:)


  • Closed Accounts Posts: 40 lucian


    Make sure the form is submitting to the same page then redirect to a thank you page.
    That's one common problem with insert in database.


  • Advertisement
  • Closed Accounts Posts: 40 lucian


    I think IMAR has a reply for you in that forum if you didn't work it out.

    Answer to your problem


Advertisement