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]
<?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 '
'; print_r($rows); echo ''; } else { echo 'Nothing returned'; } mssql_close(); ?>
[/php]