PHP SQL Code
Posted: Tue Oct 15, 2013 2:57 pm
Hello, im starting out with a basic php sql code and I will be building on it. However upon testing I have found that It is refusing to write to the database. Can some one please check over the code and tell me if its all correct.
Code: Select all
<?php
$f_name = $_POST['firstname'];
$l_name = $_POST ['lastname'];
$username = $_POST['username'];
$pass1 = $_POST['password'];
$pass2 = $_POST['password2'];
$date = date('m/d/Y h:i:s', time());
$domain = 'mydomain.org.uk'; //Insert Domain here.
include ('inc/db/conn.php');
$hash = md5($pass1);
$hash2 = md5($pass2);
if ($hash == $hash2) {
$mysql = "INSERT INTO `hm_accounts`(
`accountdomainid`,
`accountadminlevel`,
`accountaddress`,
`accountpassword`,
`accountactive`,
`accountisad`,
`accountaddomain`,
`accountadusername`,
`accountmaxsize`,
`accountvacationmessageon`,
`accountvacationmessage`,
`accountvacationsubject`,
`accountpwencryption`,
`accountforwardenabled`,
`accountforwardaddress`,
`accountforwardkeeporiginal`,
`accountenablesignature`,
`accountsignatureplaintext`,
`accountsignaturehtml`,
`accountlastlogontime`,
`accountvacationexpires`,
`accountvacationexpiredate`,
`accountpersonfirstname`,
`accountpersonlastname`)
VALUES (
'2',
'0',
'$username@$domain',
'',
'1',
'0',
'',
'',
'0',
'0',
'0',
'0',
'3',
'0',
'',
'0',
'0',
'',
'',
'$date',
'0',
'$date',
'$f_name',
'$l_name')";
}
else {
echo "Passwords do not match. Please try again";
}
mysql_close()
?>