Jump to content

[SOLVED] weird problem in small script


aebstract

Recommended Posts

I don't get it :/ I have a column called payment, which is either 'credit' or '30Day' and right now I have this script:

 

$result = mysql_query("SELECT * FROM p_orders WHERE customer_id='$id' ORDER BY id DESC") or DIE(mysql_error());
      while($r=mysql_fetch_array($result))
      {

      $invoice=$r["id"];
      $orderdate=$r["order_date"];
      $po=$r["po"];
      $orderdate = explode(' ', $orderdate);
      $orderdate = $orderdate[0];
      $payment=$r["payment"];
      $payed=$r["payed"];


if ($payment == 'credit'){
if ($payed == 0){
$paynow = "<a href=\"$payment\"><font color=\"red\">(pay)</font></a>";
}
}
$row_color = ($row_count % 2) ? $color1 : $color2;

$order_history .= "<tr class=\"tableRowCursor\" style=\"background-image: url($row_color);\" onclick=\"DoNav('index.php?page=myorders&invoice=$invoice');\"><td>$orderdate</td><td></td><td>i$invoice $paynow</td><td></td><td>$po</td></tr>";

$row_count++;

      }

 

Which is placing all my rows from the database, correctly. However, the bit about the payment deal:

 

if ($payment == 'credit'){
if ($payed == 0){
$paynow = "<a href=\"$payment\"><font color=\"red\">(pay)</font></a>";
}
}

 

It is displaying a link beside every item except the first one and every single item is saying credit, when half of them are 30Day in the database.. any ideas?

Link to comment
https://forums.phpfreaks.com/topic/144913-solved-weird-problem-in-small-script/
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.