MS SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesMS SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
You don't need a fax machine to get faxes. Get a fax-to-email fax number from CallWave. Try it free.
  #1  
Old November 5th, 2003, 03:29 AM
leslie.owensby leslie.owensby is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Location: UK
Posts: 6 leslie.owensby User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Exclamation PHP MSSQL Syntax for stored proceedures



I need to know how to call a stored proceedure in MS SQL using PHP on a Windows NT server.

I searched the net to find all references to calling one on a Linux server using the PHP functions 'mssql_'.

Here is how i do it now:

PHP Code:
 $conn = new COM("ADODB.Connection") or die("Cannot start ADO"); 
$conn->Open("PROVIDER=SQLOLEDB;DRIVER={SQL SERVER};Server=MY_SERVER;Database=MY_DATABASE;UID=MY_USERNAME;PWD=MY_PASS;"); 

// HERE IS WHAT THE STORED PROCEEDURE SAYS IN SQL SERVER
//
// Select * from tbl_countries
//

$sql "procTestCall";

$rs $conn->Execute($sql);

while (!
$rs->EOF) {
    
    
$fv $rs->Fields("COUNTRY");
    
$display $fv->value;

    
$rs->MoveNext();
}
$rs->Close(); 


I need to know how to send a parameter/ variable to the stored proceedure & how to retrieve them back using this method.

Any help is appreciated.

Cheers.

Reply With Quote
  #2  
Old November 5th, 2003, 03:47 AM
pabloj's Avatar
pabloj pabloj is offline
Modding: Oracle MsSQL Firebird
Dev Shed God 5th Plane (7000 - 7499 posts)
 
Join Date: Jun 2001
Location: Outside US
Posts: 7,410 pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 2 Months 2 Weeks 11 h 6 m 4 sec
Reputation Power: 255

Reply With Quote
  #3  
Old January 13th, 2004, 03:10 PM
rlorenzo's Avatar
rlorenzo rlorenzo is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 95 rlorenzo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 36 m 34 sec
Reputation Power: 5
sorry to bump this old thread, but this is exactly what I need to do and the link given is broken.

Reply With Quote
  #4  
Old January 13th, 2004, 03:27 PM
rlorenzo's Avatar
rlorenzo rlorenzo is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 95 rlorenzo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 36 m 34 sec
Reputation Power: 5
http://www.devarticles.com/c/a/PHP/...m-PHP-on-Linux/

sorry, link wasn't broken, just didn't point to the exact article

Reply With Quote
  #5  
Old January 13th, 2004, 03:44 PM
pabloj's Avatar
pabloj pabloj is offline
Modding: Oracle MsSQL Firebird
Dev Shed God 5th Plane (7000 - 7499 posts)
 
Join Date: Jun 2001
Location: Outside US
Posts: 7,410 pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 2 Months 2 Weeks 11 h 6 m 4 sec
Reputation Power: 255
Yeah, they seem to have reorganized their site.
Note that this is not the only way of connecting to a remote MSSQL server from Linux.
Check http://sourceforge.net/projects/odbtp/ to see an example (which works with Access also).

Reply With Quote
  #6  
Old January 13th, 2004, 06:26 PM
rlorenzo's Avatar
rlorenzo rlorenzo is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 95 rlorenzo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 36 m 34 sec
Reputation Power: 5
Okay.. I still need help in getting results from the MSSQL's stored procedures.

I followed the directions in the article and edited and recomplied my PHP source... but I have a question on how to bind variables to my procedure call... they only give one example and I think I need more.

I have a stored procedure that returns several rows... how would I bind a result? In the example they just show the binding of a result if just expecting a single integer value.



Also, I tried doing the simple thing such as:

$dbquery="EXECUTE storedProcedure 'parameter'";
$result = mssql_query($dbquery);

But I get timeouts....

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMS SQL Development > PHP MSSQL Syntax for stored proceedures


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five "checkpoints" for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway