This is a discussion on OBDC Stored Procedure Call using PHP within the PHP Language forums, part of the PHP Programming Forums category; The PHP below calls a stored procedure in a MSSQL database when I am using SQL in a Windows environment. ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
The PHP below calls a stored procedure in a MSSQL database when I am
using SQL in a Windows environment. I've recently switched to a UNIX environment and am now using ODBC (via FreeTDS) to connect to the MSSQL database. I need to rewrite the PHP below to use the odbc_connect terminology instead of the mssql_connect terminology. Can anyone help me with this? I know the changes are probably simple, but I don't even know where to start. My connection doesn't recognize the mssql_init, mssql_bind and mssql_execute statements. I can see the statements that are being accepted look more like odbc_connect and odbc_execute but I don't know how to change the syntax to use these statements correctly. $sp = mssql_init("sp_password"); // 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); Thanks!! |
|
|||
|
ckauvar@gmail.com wrote:
> The PHP below calls a stored procedure in a MSSQL database when I am > using SQL in a Windows environment. I've recently switched to a UNIX > environment and am now using ODBC (via FreeTDS) to connect to the > MSSQL database. > > I need to rewrite the PHP below to use the odbc_connect terminology > instead of the mssql_connect terminology. Can anyone help me with > this? I know the changes are probably simple, but I don't even know > where to start. My connection doesn't recognize the mssql_init, > mssql_bind and mssql_execute statements. I can see the statements > that are being accepted look more like odbc_connect and odbc_execute > but I don't know how to change the syntax to use these statements > correctly. > > $sp = mssql_init("sp_password"); // 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); > > Thanks!! Sounds like you need to load the MSSQL drivers. Why not fix that problem instead? -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ================== |
|
|||
|
On Jun 26, 11:46 pm, Jerry Stuckle <jstuck...@attglobal.net> wrote:
> ckau...@gmail.com wrote: > > The PHP below calls a stored procedure in a MSSQL database when I am > > using SQL in a Windows environment. I've recently switched to a UNIX > > environment and am now using ODBC (via FreeTDS) to connect to the > > MSSQL database. > > > I need to rewrite the PHP below to use the odbc_connect terminology > > instead of the mssql_connect terminology. Can anyone help me with > > this? I know the changes are probably simple, but I don't even know > > where to start. My connection doesn't recognize the mssql_init, > > mssql_bind and mssql_execute statements. I can see the statements > > that are being accepted look more like odbc_connect and odbc_execute > > but I don't know how to change the syntax to use these statements > > correctly. > > > $sp = mssql_init("sp_password"); // 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); > > > Thanks!! > > Sounds like you need to load the MSSQL drivers. Why not fix that > problem instead? > > - > ================== > Remove the "x" from my email address > Jerry Stuckle > JDS Computer Training Corp. > jstuck...@attglobal.net > ================== Thanks so much Jerry! Great idea. I do have it working now thanks to your suggestion. I tried MSSQL and was able to make my stored procedure call work. I don't feel like I really understand this option. Do I need FreeTDS to make the MSSQL drivers work in UNIX? Would they have worked without FreeTDS? |
|
|||
|
ckauvar@gmail.com wrote:
> On Jun 26, 11:46 pm, Jerry Stuckle <jstuck...@attglobal.net> wrote: >> ckau...@gmail.com wrote: >>> The PHP below calls a stored procedure in a MSSQL database when I am >>> using SQL in a Windows environment. I've recently switched to a UNIX >>> environment and am now using ODBC (via FreeTDS) to connect to the >>> MSSQL database. >>> I need to rewrite the PHP below to use the odbc_connect terminology >>> instead of the mssql_connect terminology. Can anyone help me with >>> this? I know the changes are probably simple, but I don't even know >>> where to start. My connection doesn't recognize the mssql_init, >>> mssql_bind and mssql_execute statements. I can see the statements >>> that are being accepted look more like odbc_connect and odbc_execute >>> but I don't know how to change the syntax to use these statements >>> correctly. >>> $sp = mssql_init("sp_password"); // 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); >>> Thanks!! >> Sounds like you need to load the MSSQL drivers. Why not fix that >> problem instead? >> >> - >> ================== >> Remove the "x" from my email address >> Jerry Stuckle >> JDS Computer Training Corp. >> jstuck...@attglobal.net >> ================== > > Thanks so much Jerry! Great idea. I do have it working now thanks to > your suggestion. I tried MSSQL and was able to make my stored > procedure call work. I don't feel like I really understand this > option. Do I need FreeTDS to make the MSSQL drivers work in UNIX? > Would they have worked without FreeTDS? AFAIK, yes, you need FreeTDS to call MSSQL from Unix. However, I haven't had to do it for a long time. MS may have created drivers themselves (although I doubt it). -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ================== |