|
|
| Welcome to the Mac Forums forums. Please read the FAQ if you have questions. Register to participate. |
|
|||||||
| TouchArcade.com - iPhone Game Reviews and News |
![]() |
|
|
Thread Tools | Search this Thread |
|
|
#1 |
|
macrumors 6502
|
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 |
|
|
|
|
|
#2 |
|
macrumors 601
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.
__________________
|
|
|
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|