why wont my damn stored proc run

Codes here !

Moderators: egami, macek, gesf

Post Reply
fountjas
New php-forum User
New php-forum User
Posts: 1
Joined: Thu Jun 08, 2017 1:32 pm

Thu Jun 08, 2017 1:34 pm

Hi Guys,

Bit of a newbie to stored procs in MySQL, can someone tell me why my damn code won't work.

I am passing all the correct variables to this part of my script but for some reason it just does not call the stored proc, instead, I get the "'it did not run" as if there is something wrong with the SET or the call. The connection works without issue

$mysqli = new mysqli($Host, $Username, $Password, $Schema);
if ($mysqli->connect_errno) {
echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
}else{
echo 'connected<br />';
}
$mysqli->query("SET @p_operator_id = '" . $mysqli->real_escape_string($m2mUserID) . "'");
$mysqli->query("SET @p_date_from = '" . $mysqli->real_escape_string($date_from) . "'");
$mysqli->query("SET @p_date_to = '" . $mysqli->real_escape_string($date_to) . "'");
$mysqli->query("SET @p_created_on = '" . $mysqli->real_escape_string($created_on) . "'");
$mysqli->query("SET @p_company_subject_id = '" . $mysqli->real_escape_string($company_subject_id) . "'");
$mysqli->query("SET @p_company_number = '" . $mysqli->real_escape_string($company_number) . "'");
$mysqli->query("SET @p_driver_subject_id = '" . $mysqli->real_escape_string($p_driver_subject_id) . "'");
$mysqli->query("SET @p_driver_number = '" . $mysqli->real_escape_string($p_driver_number) . "'");
$mysqli->query("SET @p_history_comment = '" . $mysqli->real_escape_string($p_history_comment) . "'");

if(!$mysqli->query("CALL usp_dispatch_bookkeeping_export_receipts(@p_operator_id, @p_date_from, @p_date_to, @p_created_on, @p_company_subject_id, @p_company_number, @p_driver_subject_id, @p_driver_number, @p_history_comment)")) {
echo "CALL failed: (" . $mysqli->errno . ") " . $mysqli->error;
}else{
echo 'it did not run<br />';
}

Thanks in advance.

Post Reply