PHP stored procedure insert with MYSqli
Posted: Sat Apr 09, 2011 12:07 pm
I don't have any trouble using the mysqli class to invoke a SP that executes a select query, but I cannot figure out how to invoke a SP that executes an insert/update.
The following works like a charm for a select SP to populate a DDL
I've done several different searches on this board and just can't find what I'm looking for.
I need to insert data into about 5 or 6 different tables all at once, and I'm using commit/rollback within the SP itself so I don't have to deal with it in the PHP code itself.
The following works like a charm for a select SP to populate a DDL
Code: Select all
if (mysqli_connect_errno()){
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
} else {
$result = mysqli_query($mysqli, "call sel_title;");
if (!$result){
echo "Query failed";
} else {
while ($arResult = mysqli_fetch_array($result, MYSQLI_ASSOC)){
$title = $arResult['title'];
echo $title."<BR>";
}
}
I need to insert data into about 5 or 6 different tables all at once, and I'm using commit/rollback within the SP itself so I don't have to deal with it in the PHP code itself.