Page 1 of 1
Executing Sql-Server Stored Procedure using PHP
Posted: Mon Jun 23, 2008 4:46 pm
by focusbizla
Hello,
I am new to PHP
I have a t-sql based stored procedure which I want to execute via PHP, I have tried all odbc_prepare, odbc_execute and odbc_exec but somehow I have not been able to execute the SP.
The SP is perfectly fine as it executes properly from SQL API.
Is there a PHP setting that I need to turn on / enable for this?
Thanks in advance for your help
Re: Executing Sql-Server Stored Procedure using PHP
Posted: Mon Jun 23, 2008 6:45 pm
by Christopher
What is you SQL? Usually it is something like:
Code: Select all
oci8_execute("BEGIN myStoredProc(param1, param2...) END");
Re: Executing Sql-Server Stored Procedure using PHP
Posted: Mon Jun 23, 2008 10:07 pm
by focusbizla
I am using sql server so I am using mssql_execute, odbc_execute and other mssql functions, the begin...end before the sp name works when I am running it in sql-server, but not when I am using PHP code
Re: Executing Sql-Server Stored Procedure using PHP
Posted: Tue Jun 24, 2008 2:27 pm
by janet287
I have a similar problem.
I am pretty new to PHP and am a bit stuck.
I am working on calling a stored procedure in MSSQL using PHP. My PHP is running on Linux and my MSSQL database is running on Windows. I am using php_odbc to connect. I need to fix the obdc_execute commands in my script. I don't have them right.
Here is my old call that worked with mssql:
$sp = mssql_init("sp_encrypt_text"); // stored proc name
mssql_bind($sp, "@unencrypted", ($extpassword), SQLVARCHAR, false, false, 255);
mssql_bind($sp, "@return_encrypted", ($extpassword), SQLVARCHAR, true, false, 255);
mssql_execute($sp);
How do I change the mssql_init, mssql_bind and mssql_execute statements into odbc_execute statements?
Does anyone know?