Unable to read database query result

Hi. I am querying a table from SQL Server 2005 and seem to be unable to use the data I get back from my query. I have double checked that there is information in the table and am able to query any other table EXCEPT for this one. I was wondering if anyone could help?

Below is my code:


<?php $username = $_SESSION['Username']; $serverName = 'somepath'; $dbName = 'myDB'; $db_username = 'username'; $db_password = 'password'; $link = mssql_connect($serverName, $db_username, $db_password); if(!$link) { die('Something went wrong connecting to the database'); } else echo 'Success!
'; $selected = mssql_select_db($dbName); if(!$selected) { die('Could not select the correct database.'); } $query = "SELECT * FROM MyTable"; $results = mssql_query($query); if($results)//Did I get something back? { echo mssql_num_rows($results); while($row = mssql_fetch_array($results)) { $rows[] = $row; } echo '
   echo '
'; } else { echo 'Nothing returned'; } mssql_close(); ?>


Turns out it wasn’t a PHP issue. There is a system call that calls another database to populate my table. The update kept dropping the whole table instead of updating it.

Sponsor our Newsletter | Privacy Policy | Terms of Service