|
Missing something in syntax?
Howdy. I simply wish to run an INSERT. When this case is called, the page appears blank, even if I place an echo BEFORE this action. Below is my code, and to get the echo to display, I commented out my $statement... lines.
PHP Code:
case "create":
echo "INSERT INTO `rolodex` (CustomerID, FLName, Position, Number, Type, E-mail, Note) VALUES (" . $_POST['companyID'] . ", '" . $_POST['name'] . "', '" . $_POST['position'] . "', '" . $_POST['number'] . "', '" . $_POST['type'] . "', '" . $_POST['email'] . "', '" . $_POST['note'] . "')";
$statement = $link->prepare("INSERT INTO `rolodex` (CustomerID, FLName, Position, Number, Type, E-mail, Note) VALUES (?, ?, ?, ?, ?, ?, ?)");
$statement->bind_param('issssss', $_POST['companyID'], $_POST['name'], $_POST['position'], $_POST['number'], $_POST['type'], $_POST['email'], $_POST['note']);
$statement->execute();
$statement->close();
$companyID = $_GET['id'];
$var = setVars();
$submit = "Edit";
$formAction = "?loc=rolodex&action=edit&id=" . $companyID;
break;
And the echo offers:
Code:
INSERT INTO `rolodex` (CustomerID, FLName, Position, Number, Type, E-mail, Note) VALUES (149, 'Triple Yep', 'Owners', '234-567-8900', 'Cell', 'xgjxjk@xdjgxj.com', 'Some note')
Any help would be greatly appreciated. Thanks.
Edit: Had to enclose the `E-Mail` field name in backticks.
Last edited by ManiacDan : March 4th, 2013 at 08:18 AM.
|