Bluehost.com Web Hosting $6.95

OBDC Stored Procedure Call using PHP

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. ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 06-27-2008
ckauvar@gmail.com
 
Posts: n/a
Default 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!!
Reply With Quote
  #2 (permalink)  
Old 06-27-2008
Jerry Stuckle
 
Posts: n/a
Default Re: OBDC Stored Procedure Call using PHP

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
==================
Reply With Quote
  #3 (permalink)  
Old 06-27-2008
ckauvar@gmail.com
 
Posts: n/a
Default Re: OBDC Stored Procedure Call using PHP

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?
Reply With Quote
  #4 (permalink)  
Old 06-27-2008
Jerry Stuckle
 
Posts: n/a
Default Re: OBDC Stored Procedure Call using PHP

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
==================
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 06:21 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0