derrickorama
Programmer
I'm trying to call a procedure I made from a PHP page I made running on Apache server. Here is the snippet of PHP that I'm working with:
$query = "CALL insertTotals($cash20,$cash10,$cash5,$cash1,$cash025,$cash010,$cash005,$cash001,$other,$checks,$card,$invoice,$cardtotal,$checkinsales,$totalz,$date)";
mysql_query($query);
Here is the procedure:
DELIMITER $$
DROP PROCEDURE IF EXISTS `register`.`insertTotals` $$
CREATE PROCEDURE `insertTotals`(IN cash20V DECIMAL(6,2),IN cash10V DECIMAL(6,2),IN cash5V DECIMAL(6,2),IN cash1V DECIMAL(6,2),IN cash025V DECIMAL(6,2),IN cash010V DECIMAL(6,2),IN cash005V DECIMAL(6,2),IN casH001V DECIMAL(6,2),IN otherV DECIMAL(6,2),IN checksV DECIMAL(6,2),IN cardV DECIMAL(6,2),IN invoiceV DECIMAL(6,2),IN cardtotalV DECIMAL(6,2),IN checkinsalesV DECIMAL(6,2),IN TotalzV DECIMAL(6,2),IN dateV DATETIME)
BEGIN
INSERT INTO Totals Values (
ROUND(cash20V),
ROUND(cash10V),
ROUND(cash5V),
ROUND(cash1V),
ROUND(cash025V),
ROUND(cash010V),
ROUND(cash005V),
ROUND(cash001V),
ROUND(otherV),
ROUND(checksV),
ROUND(cardV),
ROUND(invoiceV),
ROUND(cardtotalV),
ROUND(checkinsalesV),
ROUND(totalzV),
dateV
);
SELECT * FROM Totals WHERE Date = dateV;
END $$
DELIMITER ;
For some reason it won't actually insert any of the data when I try calling it through PHP, but it works just fine when I run it through MySQL Query Browser. I know for a fact that it works for the user I'm connecting with. For some odd reason, it will run the SELECT statement in the procedure, but still fail at running the INSERT statement. Again, the procedure, in all it's entirety, works when I call it through the query browser, but not through PHP. What could the problem be???
$query = "CALL insertTotals($cash20,$cash10,$cash5,$cash1,$cash025,$cash010,$cash005,$cash001,$other,$checks,$card,$invoice,$cardtotal,$checkinsales,$totalz,$date)";
mysql_query($query);
Here is the procedure:
DELIMITER $$
DROP PROCEDURE IF EXISTS `register`.`insertTotals` $$
CREATE PROCEDURE `insertTotals`(IN cash20V DECIMAL(6,2),IN cash10V DECIMAL(6,2),IN cash5V DECIMAL(6,2),IN cash1V DECIMAL(6,2),IN cash025V DECIMAL(6,2),IN cash010V DECIMAL(6,2),IN cash005V DECIMAL(6,2),IN casH001V DECIMAL(6,2),IN otherV DECIMAL(6,2),IN checksV DECIMAL(6,2),IN cardV DECIMAL(6,2),IN invoiceV DECIMAL(6,2),IN cardtotalV DECIMAL(6,2),IN checkinsalesV DECIMAL(6,2),IN TotalzV DECIMAL(6,2),IN dateV DATETIME)
BEGIN
INSERT INTO Totals Values (
ROUND(cash20V),
ROUND(cash10V),
ROUND(cash5V),
ROUND(cash1V),
ROUND(cash025V),
ROUND(cash010V),
ROUND(cash005V),
ROUND(cash001V),
ROUND(otherV),
ROUND(checksV),
ROUND(cardV),
ROUND(invoiceV),
ROUND(cardtotalV),
ROUND(checkinsalesV),
ROUND(totalzV),
dateV
);
SELECT * FROM Totals WHERE Date = dateV;
END $$
DELIMITER ;
For some reason it won't actually insert any of the data when I try calling it through PHP, but it works just fine when I run it through MySQL Query Browser. I know for a fact that it works for the user I'm connecting with. For some odd reason, it will run the SELECT statement in the procedure, but still fail at running the INSERT statement. Again, the procedure, in all it's entirety, works when I call it through the query browser, but not through PHP. What could the problem be???