grahamb314 Posted October 14, 2008 Share Posted October 14, 2008 Hi all Just a small problem: i have this: ( <?php require('../mysql_connect.php'); $result = mysqli_query($mysqli, "SELECT * FROM `grahamb_test`.`booking`"); echo "<table border='1'> <tr> <th>Name</th> <th>Slot</th> <th>Day</th> <th>Month</th> <th>Year</th> </tr>"; while($row = @mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['name'] . "</td>"; echo "<td>" . $row['slot'] . "</td>"; echo "<td>" . $row['day'] . "</td>"; echo "<td>" . $row['month'] . "</td>"; echo "<td>" . $row['year'] . "</td>"; echo "</tr>"; } echo "</table>"; ?> require('../mysql_connect.php') connects the the DB fine The output source I get is: <table border='1'> <tr> <th>Name</th> <th>Slot</th> <th>Day</th> <th>Month</th> <th>Year</th> </tr></table>echo $day; echo ' '; echo $month; echo ' '; echo $year; echo' at '; echo $slot; echo ' by '; echo $name; Any thoughts? Link to comment https://forums.phpfreaks.com/topic/128425-solved-not-echoing-html-table/ Share on other sites More sharing options...
DarkWater Posted October 14, 2008 Share Posted October 14, 2008 Remove the @ from in front of mysql_fetch_assoc(). Also, why are you using a mysql fetch function with mysqli? Link to comment https://forums.phpfreaks.com/topic/128425-solved-not-echoing-html-table/#findComment-665469 Share on other sites More sharing options...
CroNiX Posted October 14, 2008 Share Posted October 14, 2008 In addition, You should probably use: mysqli_fetch_assoc() instead of: mysql_fetch_array() Link to comment https://forums.phpfreaks.com/topic/128425-solved-not-echoing-html-table/#findComment-665473 Share on other sites More sharing options...
wildteen88 Posted October 14, 2008 Share Posted October 14, 2008 The problem I see is you're two different function sets, you use mysqli_query however you use mysql_fetch_assoc Your cannot use mysqli_* functions and mysql_* functions together. They are not compatible. Link to comment https://forums.phpfreaks.com/topic/128425-solved-not-echoing-html-table/#findComment-665474 Share on other sites More sharing options...
grahamb314 Posted October 14, 2008 Author Share Posted October 14, 2008 Yea, sorry a typo! And for some reason I need to keep the @ there Thanks again!! Link to comment https://forums.phpfreaks.com/topic/128425-solved-not-echoing-html-table/#findComment-665475 Share on other sites More sharing options...
DarkWater Posted October 14, 2008 Share Posted October 14, 2008 Yea, sorry a typo! And for some reason I need to keep the @ there Thanks again!! What would that reason be? If it's covering up an error (which is what the operator does), don't do it. Just fix the error. Link to comment https://forums.phpfreaks.com/topic/128425-solved-not-echoing-html-table/#findComment-665490 Share on other sites More sharing options...
grahamb314 Posted October 14, 2008 Author Share Posted October 14, 2008 Just removed the '@' and it still works fine! I just remember being told to do it after an upgrade to a new php version. All done now though thanks!! Link to comment https://forums.phpfreaks.com/topic/128425-solved-not-echoing-html-table/#findComment-665497 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.