Jump to content

[SOLVED] Echo problems


nathan1

Recommended Posts

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']; 

}
?>

Link to comment
https://forums.phpfreaks.com/topic/89129-solved-echo-problems/
Share on other sites

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']; 

}
?>

Link to comment
https://forums.phpfreaks.com/topic/89129-solved-echo-problems/#findComment-456456
Share on other sites

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 :P

<?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']; 

}
?>

Link to comment
https://forums.phpfreaks.com/topic/89129-solved-echo-problems/#findComment-456474
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.