Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

ChoMomma

macrumors 6502
Original poster
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.

????
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.