خرید بک لینک
so I have a table of foods that fill filed nama_makanan, weight, calories, fat, karbo and protein, nah I want to display the food data tsb with the ancak and the results of data in the show is automatically saved to the database.
this is sourcode
Code:

<?
$sumtotal1=0;
$kal= 2268; // nilai kalori
$hasil_pro_pagi        = 350; // nilai protein
$hasil_lemak_pagi= 450; // nilai lemak
$hasil_karbo_pagi= 250; // nilai karbo
$data1 = mysql_query("SELECT * FROM makanan ORDER BY RAND() limit 10");
while ($row1 = mysql_fetch_array($data1))
{
$sumtotal1+=$row1[kalori];       
$sumtotalpropagi+=$row1[protein];
$sumtotallemakpagi+=$row1[lemak];
$sumtotalkarbopagi+=$row1[karbo];
if ($sumtotal1 <= $kal) // untuk kondisi hitung kalori
{
if ($sumtotalpropagi <= $hasil_pro_pagi) // untuk kondisi hitung protein
{
if($sumtotallemakpagi <= $hasil_lemak_pagi) // untuk kondisi hitung lemak
{       
if ($sumtotalkarbopagi <= $hasil_karbo_pagi) // untuk kondisi hitung karbo
{        echo $row1[nama]."[".$row1[berat]."gram"."]"."[".$row1[kalori]."kal"."]"."<br>"; //hasil makanan dan jumlah kalori permakanan
}
}
}
}
else
{
echo $sumtotal1 = $sumtotal1 - $row1[kalori];
break;
}
}
?>

this just shows only ... but why the results of the number of calories that can be very far out with the initial caloric value ... it can not fit but at least approached and the food and the number of calories also not fitting food .... please helpClick image for larger version. 

Name:	GAMBAR.png 
Views:	10 
Size:	5.8 KB 
ID:	17626
Attached Thumbnails
Click image for larger version. 

Name:	GAMBAR.png 
Views:	N/A 
Size:	5.8 KB 
ID:	17626  

برچسب: نویسنده: آیلین رضوانی تاريخ: پنجشنبه 2 آذر 1396 ساعت: 16:25

صفحه بندی