I am looking for the proper parameters for INSERT INTO using stored procedure
Here is the result I am getting from this stored procedure...
Inserts the $POST[] function Into the employees table:
$_POST[FirstName]
$_POST[LastName]
This should "execute" the $POST[] function and insert the correct data:
Mike
Richards
Question is:
Why is this inserting the $POST[] function instead of executing it ?...
I have tried
'$_POST[FirstName]' and
'" .$_POST['FirstName']. '"
Does not seem to be the correct parameters when using stored procedure
Code:
<?php
// create new stored procedure
$insert = "(FirstName, LastName) VALUES ( '\$_POST[FirstName]', '\$_POST[LastName]')";
$sql = ("CREATE PROCEDURE sp_employees() INSERT INTO `employees` $insert ");
mysql_select_db('$c_database');
$res = mysql_query( $sql, $connection )
or die('Could not create sp_employees: ' . mysql_error());
header("Location: ./sp_manager.php") ;
mysql_close($connection);
}
?>
Code to call the procedure
Code:
<?php
if($_POST['Submit']) { mysql_query("CALL sp_employees ()");
header("Location: ./employees.php");
}
?>