Jaguar83 Posted January 21, 2010 Share Posted January 21, 2010 ...I posted this in the MySQL forum and got a response that indicated to me that I should repost it here... Hi all, thanks for taking the time to look at my problem...Forgive me if this is not in the right forum (I will post in the more general PHP forum if any of you feel that it is a better location for the question). I have a simple MySQL database with a 'coinorder' table. The table is populated correctly, etc. When I run the query within MySQL (copy and paste the result of '$query_vieworders'...which is the correct query), it executes and returns the data properly. When I implement it within my code, it only, seemingly, prints out every other row in html and the '$temp_orderview[0]' below is not correct. <?php $addorder_list = array('order_id', 'account_id', 'order_rcvd_month', 'order_rcvd_day', 'order_rcvd_year', 'order_shipmeth', 'order_comm', 'user_id'); $query_vieworders = 'SELECT '; foreach($addorder_list as $sqlname) { if ($sqlname == 'order_id') { $query_vieworders .= 'order_id'; } else { $query_vieworders .= ', ' . $sqlname; } } $query_vieworders .= ' FROM coinorder '; if(empty($_GET['order'])) { $query_vieworders .= 'ORDER BY order_id'; } // echo $query_vieworders; $result_vieworders = mysqli_query($dbc, $query_vieworders) or die(mysqli_error($dbc)); echo '<div id="vieworder"> <h3>Select Order</h3> <table id="vieworder"> <tr class="tablehead">'; foreach($addorder_list as $name) { echo '<td>' . $name . '</td>'; } echo '<td></td> </tr>'; while ($temp_orderview = mysqli_fetch_row($result_vieworders)) { echo '<tr>'; foreach ($temp_orderview as $temp_val) { echo '<td>' . $temp_val . '</td>'; } echo '<td><a href="order.php?req=addcoinpack&id=' . $temp_orderview[0] .'>Add Coin(s)</a></td> </tr>'; } echo '</table> </div>'; ?> Can anyone spot my problem? I apologize if the formatting is a little off, I'm using a new IDE. Thanks and happy PHPing! Link to comment https://forums.phpfreaks.com/topic/189247-mysqli_fetch_row-problem-help/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.