Home › Forums › Quform PHP › touble writing form submission into MySQL database
- This topic has 1 reply, 2 voices, and was last updated 10 years, 9 months ago by Ally.
- AuthorPosts
- February 12, 2014 at 7:32 pm #8710hpwandrewParticipant
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>
February 17, 2014 at 10:13 am #8744AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
- AuthorPosts
- You must be logged in to reply to this topic.