nikkicade Posted August 15, 2006 Share Posted August 15, 2006 Hi I am new to this but have a database with a stored procedure to add a new product to the database. I have a form in which the user enters the new product information and click a submit button. The submit button then opens a new php page which calls the store procedure. I know everything is working as it should because the users have to login in order to get to the page with the form to add the new product. The form works fine and I can define the variables from the form and echo them out to the page called from the submit button using $ProductName = $_POST['ProductCode']; and echo $ProductName;. The problem I have is binding the parameters for the stored procedure. Does anyone know the correct method of binding the parameters to use with $query? Is it that I have to prepare, bind_param and execute? I have found the syntax for mysqli and have tried this $stmt = $mysqli->prepare("call usp_NewProduct(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"); $stmt->bind_param('ssssssssissdi', $ProductName, $ProductSubCategory, $ProductSubCategory2, $ProductSubCategory3, $ProductDesign, $ProductColour, $ProductSize, $ProductFragrance, $DeliveryBand, $ProductCode, $ProductDescription, $ProductPrice, $StockLevel);$ProductName = $_POST['ProductName'];$ProductSubCategory = $_POST['ProductSubCategory'];$ProductSubCategory2 = $_POST['ProductSubCategory2'];$ProductSubCategory3 = $_POST['ProductSubCategory3'];$ProductDesign = $_POST['ProductDesign'];$ProductColour = $_POST['ProductColour'];$ProductSize = $_POST['ProductSize'];$ProductFragrance = $_POST['ProductFragrance'];$DeliveryBand = $_POST['DeliveryBand'];$ProductCode = $_POST['ProductCode'];$ProductDescription = $_POST['ProductDescription'];$ProductPrice = $_POST['ProductPrice'];$StockLevel = $_POST['StockLevel'];/* execute prepared statement */ $stmt->execute(); /* close statement and connection */ $stmt->close(); but cannot get it to work.Any help would be gratefully received.ThanksNikki Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.