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
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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.