Register FAQ/Rules Forum Spy Search Today's Posts Mark Forums Read

Welcome to the Mac Forums forums. Please read the FAQ if you have questions. Register to participate.

 
Go Back   Mac Forums > Special Interests > Web Design and Development
TouchArcade.com - iPhone Game Reviews and News

Reply
 
Thread Tools Search this Thread  
Old Jun 11, 2007, 03:57 PM   #1
ChoMomma
macrumors 6502
 
Join Date: Oct 2002
Location: Near a Jack in the Box... I could go for some curly fries about now..
Send a message via AIM to ChoMomma Send a message via Skype™ to ChoMomma
PHP/ MSSQL & a stored procedure...

Anyone have experience with PHP, MSSQL and excuting a stored procedure?

I have Mac-mini running a small corporate intranet site, I have installed PHP 5 with FreeTDS so that I can access MSSQL databases that run on other company servers.

My problem is that I want I have a search form that queries a database fine, but I have a stored procedure that modifies the input on one field to bounce it off of a list of known abbreviations (ex: OS = Operating System). The stored procedure takes the input of the field and then outputs a string like db.field LIKE %Operating% OR db.field LIKE %System% OR db.field LIKE %OS%

That string needs to be put into the existing database query.

$sql = mssql_query("SELECT * FROM DBTable WHERE $storedprocedure ORDER BY x DESC");


However when I try to drop my string into that query it always complains about syntax error before ORDER.

????
__________________
-- iMac 24" 2.1ghz/3GB/250/superdrive
ChoMomma is offline   Reply With Quote
Old Jun 11, 2007, 04:42 PM   #2
jeremy.king
macrumors 601
 
jeremy.king's Avatar
 
Join Date: Jul 2002
Location: Fox Lake, IL
To exec a stored proc, you will need to use the following functions

mssql_init()
mssql_bind()
mssql_execute()


Problem is this will require two SQL calls, one for the stored proc and one for the query. The only way you could do it with one query is to write another stored proc that references the first and executes your SELECT statement.
jeremy.king is offline   Reply With Quote

Reply

Mac Forums > Special Interests > Web Design and Development

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 06:36 PM.

Mac News | Mac Rumors | iPhone Game Reviews | iPhone Apps

Powered by vBulletin® Version 3.6.10
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Copyright 2002-2009, MacRumors.com, LLC