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; ?> Quote 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. Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.