468,532 Members | 1,703 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,532 developers. It's quick & easy.

OBDC Stored Procedure Call using PHP

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!!
Jun 27 '08 #1
3 2175
ck*****@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.
js*******@attglobal.net
==================
Jun 27 '08 #2
On Jun 26, 11:46 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
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?
Jun 27 '08 #3
ck*****@gmail.com wrote:
On Jun 26, 11:46 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
>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.
js*******@attglobal.net
==================
Jun 27 '08 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Dino L. | last post: by
2 posts views Thread by jed | last post: by
7 posts views Thread by eholz1 | last post: by
reply views Thread by SOI_0152 | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.