I am 100% new to this world of SQL / PHP / ODBC / FBI / TLA etc., so I apologize if what I ask is incredibly simple.
I use a stored procedure that uses a z / z database for long lengths to take the central zipcode and the given mile radius as 2 input parameters, and then returns an array of zip codes that are within a given mile radius. It works fine when I run it in my SQL viewer, but when I try to use php for this, I get invalid parameter errors.
$connstr = "Driver={SQL Server};Server=MyServer;Database=MyDatabase;"; $conn = odbc_connect($connstr, "Name", "PW"); $query_string = " CALL FindZipCodeWithinRadius(?,?) "; $sp = odbc_prepare($conn, $query_string); $zipcodes = odbc_execute($sp,array(" 14602, 35")); print_r($zipcodes);
When I run such code, I get the error "Not enough parameters (1 must be 2)"
I tried different iterations of double quotes / single quotes around these input parameters, but they all either give me the above error, or this error:
"SQL error: [Microsoft] [SQL Server ODBC driver] Invalid parameter number, SQL status S1093"
A quick Google search leads me to believe that the second error means that there are a lot of parameters in proc, and how did I go from 1 to many, skipping the desired 2?
The database is on SQL 2000, if that matters.
Any ideas? Thanks for any help you can provide.