touble writing form submission into MySQL database

Home Forums Quform PHP touble writing form submission into MySQL database

This topic is: not resolved
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #8710
    hpwandrew
    Participant

    Im using hostgator hosting and have my database setup with user assigned to it and all permissions are set but I just cant seem to get it to work correctly

    The option is set to true.

    $config[‘database’] = true;

    Could someone please tell me what i’m doing incorrectly.

    <code>
    // Save to a MySQL database
    if ($config['database']) {
    // Connect to MySQL
    mysql_connect('localhost', 'shwamin8_user1', 'myPassword123') or die(mysql_error());

    // Select the database
    mysql_select_db(‘shwamin8_finance’) or die(mysql_error());

    // Set the connection encoding
    if (strtolower(QUFORM_CHARSET) == ‘utf-8’) {
    mysql_query(“SET NAMES utf8”) or die(mysql_error());
    }

    // Build the query
    $query = “INSERT INTO ‘pre_finance’ SET”;
    $query .= “fname = ‘” . mysql_real_escape_string($form->getValue(‘fname’)) . “‘,”;
    $query .= “lname = ‘” . mysql_real_escape_string($form->getValue(‘lname’)) . “‘,”;
    $query .= “phone = ‘” . mysql_real_escape_string($form->getValue(‘phone’)) . “‘,”;
    $query .= “email = ‘” . mysql_real_escape_string($form->getValue(’email’)) . “‘,”; ;

    // Execute the query
    mysql_query($query) or die(mysql_error());

    // Close the connection
    mysql_close();
    }

    </code>

    #8744
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Be inspired. © 2024 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy