gerkintrigg Posted March 23, 2007 Share Posted March 23, 2007 Is my math wrong with this? <?php include 'db.php'; $i=0; $no_of_rows=mysql_result(mysql_query("SELECT COUNT(*) AS RECORDS FROM schedule WHERE '$week_start2' between start_date and end_date;"),0); $pquery="SELECT cost, sup_percent FROM schedule, rate WHERE schedule.rate_id = rate.rate_id and '$week_start2' between start_date and end_date;"; $pq=mysql_query($pquery); while ($pr=mysql_fetch_array($pq)){ $i++; if ($i==1){ $price=$pr['cost']; } else{ $percentage=($price/100)*$pr['cost']; } } if ($no_of_rows==2){ $price=$price+$percentage; } echo $price; ?> Link to comment https://forums.phpfreaks.com/topic/44028-solved-first-row-from-an-array/ Share on other sites More sharing options...
Barand Posted March 23, 2007 Share Posted March 23, 2007 Is my math wrong with this? That would depend on what you are trying to do. Link to comment https://forums.phpfreaks.com/topic/44028-solved-first-row-from-an-array/#findComment-213825 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.