Jaguar83 Posted January 20, 2010 Share Posted January 20, 2010 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 new to Eclipse. Thanks and happy PHPing! Quote Link to comment https://forums.phpfreaks.com/topic/189228-mysqli_fetch_row-problem-help/ Share on other sites More sharing options...
fenway Posted January 20, 2010 Share Posted January 20, 2010 What's eclipse? Anyway, if the query is correct, it sounds like you have php syntax issues. Quote Link to comment https://forums.phpfreaks.com/topic/189228-mysqli_fetch_row-problem-help/#findComment-999002 Share on other sites More sharing options...
Jaguar83 Posted January 20, 2010 Author Share Posted January 20, 2010 Ok, thank you for getting to me so quickly ... by your response, I'm assuming you are indicating that I should post it in another forum. I thought I prefaced this in the first line of my thread... Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/189228-mysqli_fetch_row-problem-help/#findComment-999008 Share on other sites More sharing options...
Jaguar83 Posted January 21, 2010 Author Share Posted January 21, 2010 And to clarify, there are no syntax issues in this code (that I can detect). The script runs fine and does not produce errors, it just does not work in the fashion for which it was designed. I apologize for not mentioning this: Eclipse is a popular open-source IDE. Quote Link to comment https://forums.phpfreaks.com/topic/189228-mysqli_fetch_row-problem-help/#findComment-999144 Share on other sites More sharing options...
PFMaBiSmAd Posted January 21, 2010 Share Posted January 21, 2010 Your HTML is invalid. You are missing the closing double-quote on the end of the href="... ..." Quote Link to comment https://forums.phpfreaks.com/topic/189228-mysqli_fetch_row-problem-help/#findComment-999150 Share on other sites More sharing options...
Jaguar83 Posted January 21, 2010 Author Share Posted January 21, 2010 Thank you much! Foolish mistake, and yes a syntax issue, my bad. Quote Link to comment https://forums.phpfreaks.com/topic/189228-mysqli_fetch_row-problem-help/#findComment-999160 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.