nathan1 Posted February 3, 2008 Share Posted February 3, 2008 Hi guys just wondering why the following code isnt echoing all the entries....sometimes it does and sometimes it doesnt....allways the last entrie it doesnt...am i doing something wrong here? appreciate any help, thanks. <?php $history_result = mysql_query("SELECT * FROM orders WHERE client_id='$c' ORDER BY date_p DESC") or die(mysql_error()); $history_ro = mysql_fetch_array($history_result); while($result_ar = mysql_fetch_assoc($history_result)){ php echo $result_ar['date_p']; echo $result_ar['debit']; echo $result_ar['order_p']; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/89129-solved-echo-problems/ Share on other sites More sharing options...
CerealBH Posted February 3, 2008 Share Posted February 3, 2008 u have a random php in there <?php $history_result = mysql_query("SELECT * FROM orders WHERE client_id='$c' ORDER BY date_p DESC") or die(mysql_error()); $history_ro = mysql_fetch_array($history_result); while($result_ar = mysql_fetch_assoc($history_result)){ echo $result_ar['date_p']; echo $result_ar['debit']; echo $result_ar['order_p']; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/89129-solved-echo-problems/#findComment-456456 Share on other sites More sharing options...
nathan1 Posted February 3, 2008 Author Share Posted February 3, 2008 were? im not seeing it? thanks Quote Link to comment https://forums.phpfreaks.com/topic/89129-solved-echo-problems/#findComment-456468 Share on other sites More sharing options...
trq Posted February 3, 2008 Share Posted February 3, 2008 On this line.... php echo $result_ar['date_p']; Quote Link to comment https://forums.phpfreaks.com/topic/89129-solved-echo-problems/#findComment-456471 Share on other sites More sharing options...
CerealBH Posted February 3, 2008 Share Posted February 3, 2008 thats all coded diffrently than i usualy code querys, this is how i write it, there similar i just didn't take the time to write it out your way because i have no idea if it works like that just doing it the way i know works hope this helps <?php $query = "SELECT * FROM orders WHERE client_id='$c' ORDER BY date_p DESC"; $result = mysql_query($query) or die('Query failed: ' . mysql_error()); while($result_ar = mysql_fetch_array($result, MYSQL_ASSOC )) { echo $result_ar['date_p']; echo $result_ar['debit']; echo $result_ar['order_p']; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/89129-solved-echo-problems/#findComment-456474 Share on other sites More sharing options...
nathan1 Posted February 3, 2008 Author Share Posted February 3, 2008 Ok its working now, though i dont fully understand why my way wasnt working, thanks everyone Quote Link to comment https://forums.phpfreaks.com/topic/89129-solved-echo-problems/#findComment-456476 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.