I have a web form that will have input fields. These fields will be used as input parameters for the MSSQL stored procedure.
From there we are expecting to get results depending on what
user is searching for.
I don't have access to view the stored procedure code, but I have execute permissions. Below is my code. I can successfully connect, but I do not get any results. In fact I get 0 results.
Is there anything I am missing? Can't use MySQL coz this is an IIS Server;
Expand|Select|Wrap|Line Numbers
- <?php
- // Connection settings
- $host = '#####';
- $user = '######';
- $pass = '######';
- if ($conn = mssql_connect($host, $user, $pass)) // connection string
- {
- echo 'connected to Host <br/> ';
- }
- // select database
- if (mssql_select_db('USAHerds', $conn)) {
- echo ' and DB selected ';
- }
- $query = mssql_init("procAnimalBrandLicensesSearch", $conn) or die("Couldn't call stored procedure");
- $AcctFirstNames = $_GET['AcctFirstName'];
- mssql_bind($query, "@AcctFirstName", $AcctFirstNames, SQLVARCHAR, FALSE, FALSE, 20);
- $result = mssql_execute($query);
- $numProds = mssql_num_rows($result);
- echo "<h1>" . $numProds . " Result" . ($numProds == 0 ? "" : "s") . " Found for : $AcctFirstNames </h1><table border=\"1\"><tr>
- <th>First Name</th>
- <th>Last Name</th>
- <th>File Name</th>
- </tr>";
- while($row = mssql_fetch_row($result))
- {
- echo "<tr>" ."<td>" .$row["AcctFirstName"] ."</td>"."<td>". $row["AcctLastName"]."</td>". "<td>".$row["FileName"]. "</td>"."</tr>";
- }
- echo "</table>";
- ?>