|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
PHP/MSSQL Query Question
Hey guys, I've been teaching myself PHP/SQL; can someone tell me why I am only receiving one row returned in this query? I know my DB has over a 100 rows and I want them all to display. I have not been able to find many examples using mssql except for the PHP manual, is mysql basically the same thing? Thanks!
</tr> <?php $db_name = "db name"; $table_name = "table name"; $connection = mssql_connect("", "", "") or die("Unable to connect to the database."); $db = mssql_select_db($db_name, $connection) or die("Unable to connect to the database."); $query = "SELECT ID, DistrictName FROM $table_name ORDER BY ASC"; $result = mssql_query($query, $connection) or die("Could not process query."); while ($row = mssql_fetch_array($result)) { $ID = $row['ID']; $DistrictName = $row['DistrictName']; } ?> <tr> <td> <?php echo "$ID" ?> </td> <td> <?php echo "$DistrictName" ?> </td> </tr> </table> |
|
#2
|
|||
|
|||
|
RE: PHP/MSSQL Query Question
You're ending your while() clause too early...
try this: |
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Database Help > PHP/MSSQL Query Question |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|