phpmonster69 Posted April 26, 2011 Share Posted April 26, 2011 this line is always causing an error for me, can anyone tell whats wrong $query = "SELECT * FROM Class"; $result = mssql_query($query) or die("Couldn't change the data!"); echo "<table border="1"> <tr> <th>ClassNo</th> <th>Days</th> <th>TimePeriod</th> <th>StartDate</th> <th>EmployeeID</th> <th>RoomID</th> <th>CourseNo</th> </tr>"; while ( $record = mssql_fetch_array($result) ){ echo "<tr><td>" . $record["ClassNo"] . "</td><td>" . $record["Days"] . "</td><td>" . $record["TimePeriod"] . "</td><td>" . $record["StartDate"]."</td><td>" . $record["EmployeeID"] . "</td><td>" . $record["RoomID"] . "</td><td>" . $record["CourseNo"] . "</td></tr>"; } echo "</table>"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/234724-help/ Share on other sites More sharing options...
fugix Posted April 26, 2011 Share Posted April 26, 2011 at first glance...looks like in your first table..you are missing your <td>'s...what errors do you receive? Quote Link to comment https://forums.phpfreaks.com/topic/234724-help/#findComment-1206232 Share on other sites More sharing options...
Fadion Posted April 26, 2011 Share Posted April 26, 2011 For god's sake, how is one going to manage that code of yours? Even you can't! There's no need to echo the whole table in one row! <?php $query = "SELECT * FROM Class"; $result = mssql_query($query) or die('Error: ' . mssql_get_last_message()); ?> <table border="1"> <tr> <th>ClassNo</th> <th>Days</th> <th>TimePeriod</th> <th>StartDate</th> <th>EmployeeID</th> <th>RoomID</th> <th>CourseNo</th> </tr> <?php while ($record = mssql_fetch_array)) { ?> <tr> <td><?php echo $record["ClassNo"]; ?></td> <td><?php echo $record["Days"]; ?></td> <td><?php echo $record["TimePeriod"]; ?></td> <td><?php echo $record["StartDate"]; ?></td> <td><?php echo $record["EmployeeID"]; ?></td> <td><?php echo $record["RoomID"]; ?></td> <td><?php echo $record["CourseNo"]; ?></td> </tr> <?php } ?> Isn't it way more readable like this? Notice that appart from formatting it, I added mssql_get_last_message() to your query. If the query fails, it should show what error are you getting. Quote Link to comment https://forums.phpfreaks.com/topic/234724-help/#findComment-1206236 Share on other sites More sharing options...
fugix Posted April 26, 2011 Share Posted April 26, 2011 Yes if you are receiving any errors let us know what they are Quote Link to comment https://forums.phpfreaks.com/topic/234724-help/#findComment-1206251 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.