Why doesn't this work:
// ------ Insert Admin Details ------
$sql = 'INSERT INTO `totalweb`.`users` (
`id` ,
`name` ,
`password` ,
`title` ,
`forename` ,
`surname` ,
`address` ,
`postcode` ,
`phone` ,
`fax` ,
`email`
)
VALUES (
NULL ,
' . $_POST['usrname'] . ',
' . $_POST['usrpass'] . ',
' . $_POST['usrtitle'] . ',
' . $_POST['usrfname'] . ',
' . $_POST['usrsname'] . ',
' . htmlentities($_POST['usradd']) . ',
' . $_POST['usrpcode'] . ',
' . $_POST['usrphone'] . ',
' . $_POST['usrfax'] . ',
' . $_POST['usremail'] . '
);';
if (mysql_query($sql,$conx)){
echo 'Insert Admin Details: Success<br /><br />';
}else{
die('Error Insterting Data: ' . mysql_error()) . '<br /><br />';
}
I receive an error near the address part (usradd) but i can't figure out why. The variable spans multiple lines but i thought i'd solved that problem with the htmlentities function.
// ------ Insert Admin Details ------
$sql = 'INSERT INTO `totalweb`.`users` (
`id` ,
`name` ,
`password` ,
`title` ,
`forename` ,
`surname` ,
`address` ,
`postcode` ,
`phone` ,
`fax` ,
`email`
)
VALUES (
NULL ,
' . $_POST['usrname'] . ',
' . $_POST['usrpass'] . ',
' . $_POST['usrtitle'] . ',
' . $_POST['usrfname'] . ',
' . $_POST['usrsname'] . ',
' . htmlentities($_POST['usradd']) . ',
' . $_POST['usrpcode'] . ',
' . $_POST['usrphone'] . ',
' . $_POST['usrfax'] . ',
' . $_POST['usremail'] . '
);';
if (mysql_query($sql,$conx)){
echo 'Insert Admin Details: Success<br /><br />';
}else{
die('Error Insterting Data: ' . mysql_error()) . '<br /><br />';
}
I receive an error near the address part (usradd) but i can't figure out why. The variable spans multiple lines but i thought i'd solved that problem with the htmlentities function.