473,385 Members | 1,817 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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 2357
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: dinesh prasad | last post by:
I'm trying to use a servlet to process a form, then send that data to an SQL server stored procedure. I'm using the WebLogic 8 App. server. I am able to retrieve database information, so I know my...
0
by: Nashat Wanly | last post by:
HOW TO: Call a Parameterized Stored Procedure by Using ADO.NET and Visual C# .NET View products that this article applies to. This article was previously published under Q310070 For a Microsoft...
2
by: Dino L. | last post by:
How can I run stored procedure (MSSQL) ?
2
by: singlal | last post by:
Hi, my question was not getting any attention because it moved to 2nd page; so posting it again. Sorry for any inconvenience but I need to get it resolved fast. Need your help! ...
1
by: deepdata | last post by:
Hi, I am trying to fetch data from db2 (express version) database by calling stored procedure. I have tried to use both cursor and for loop but still i am getting error. --======Start...
2
by: jed | last post by:
I have created this example in sqlexpress ALTER PROCEDURE . @annualtax FLOAT AS BEGIN SELECT begin1,end1,deductedamount,pecentageextra FROM tax
7
by: eholz1 | last post by:
Hello PHP group, Could someone help me out? I have PHP 5.2, Apache 2.0, and MySQL 5.0 running on Linux (Redhat Fedora Core 6). All that works fine. I would like to be able to "call" a stored...
0
by: SOI_0152 | last post by:
Hi all! Happy New Year 2008. Il hope it will bring you love and happyness I'm new on this forum. I wrote a stored procedure on mainframe using DB2 7.1.1 and IBM language c. Everything works...
7
by: jamesclose | last post by:
My problem is this (apologies if this is a little long ... hang in there): I can define a function in VB.NET with optional parameters that wraps a SQL procedure: Sub Test(Optional ByVal Arg1...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.