Stored Procedures, MySQL and PHP

@michal kralik – unfortunately there’s a bug with the MySQL C API that PDO uses which means that running your code as above with some versions of MySQL results in the error: “Syntax error or access violation: 1414 OUT or INOUT argument $parameter_number for routine $procedure_name is not a variable or NEW pseudo-variable”. You can … Read more

MySQL : When stored procedure parameter name is the same as table column name

Simplest way to distinguished between your parameter and column (if both name is same) is to add table name in your column name. UPDATE customers SET customers.Name = Name; Even you can also add database prefix like UPDATE yourdb.customers SET yourdb.customers.Name = Name; By adding database name you can perform action on more than 1 … Read more

How to execute a stored procedure in php using sqlsrv and “?” style parameters

The user contributions on the php.net have a write up on how to execute a stored procedure using the sqlsrv-prepare. In case that is removed from the php.net user contributions in the future here is what it had(has) listed: $procedure_params = array( array(&$myparams[‘Item_ID’], SQLSRV_PARAM_OUT), array(&$myparams[‘Item_Name’], SQLSRV_PARAM_OUT) ); // EXEC the procedure, {call stp_Create_Item (@Item_ID = … Read more

Getting the Return Value from JDBC MSSQL

Bozho’s 2nd revised answer was close but not quite there. It did lead me to the answer though. Taking the code example I started with we end up with: CallableStatement proc = connection.prepareCall(“{ ? = call dbo.mySproc() }”); proc.registerOutParameter(1, Types.INTEGER); proc.execute(); int returnValue = proc.getInt(1); The key pieces here are the “? =” in front … Read more