 |
|
ดีเพื่อนๆพี่ๆทุกคนนะค่ะคือเราต้องการทราบวิธีการที่จำนำค่าที่ได้จากฐานข้อมูลมาคำนวณอะค่ะ คือเราสามารถดึงค่าแต่ละค่ามาได้แล้วอะ แต่เรา
ไม่ทราบวิธีนำค่าเหล่านั้นมาคำนวณอะค่ะ ใครรู้ช่วยบอกทีนะคะ ^-^
Code (PHP)
<b>คำนวณ<br></b>
<?php
include "connectdatabase.php";
include "init.inc.php";
$link=mysql_connect($hostname, $username, $password);
mysql_select_db($dbid) or die("unable to connect");
$result=mysql_query("SELECT equipprice FROM changetype");
for ($i = 0; $i < mysql_num_rows($result); ++$i)
{$line = mysql_fetch_row($result);}
print $line[0];
mysql_close($link);
?>
<?php
include "connectdatabase.php";
include "init.inc.php";
$link=mysql_connect($hostname, $username, $password);
mysql_select_db($dbid) or die("unable to connect");
$result=mysql_query("SELECT mainfloprice FROM mainflower");
for ($i = 0; $i < mysql_num_rows($result); ++$i)
{$line = mysql_fetch_row($result);}
print "<br>$line[0]";
mysql_close($link);
?>
<?php
include "connectdatabase.php";
include "init.inc.php";
$link=mysql_connect($hostname, $username, $password);
mysql_select_db($dbid) or die("unable to connect");
$result=mysql_query("SELECT mainfloquan FROM mainflower");
for ($i = 0; $i < mysql_num_rows($result); ++$i)
{$line = mysql_fetch_row($result);}
print "<br>$line[0]";
mysql_close($link);
?>
<?php
include "connectdatabase.php";
include "init.inc.php";
$link=mysql_connect($hostname, $username, $password);
mysql_select_db($dbid) or die("unable to connect");
$result=mysql_query("SELECT paperflowerprice FROM paperflower");
for ($i = 0; $i < mysql_num_rows($result); ++$i)
{$line = mysql_fetch_row($result);}
print "<br>$line[0]";
mysql_close($link);
?>
<?php
include "connectdatabase.php";
include "init.inc.php";
$link=mysql_connect($hostname, $username, $password);
mysql_select_db($dbid) or die("unable to connect");
$result=mysql_query("SELECT ribbinflowerprice FROM ribbinflower1");
for ($i = 0; $i < mysql_num_rows($result); ++$i)
{$line = mysql_fetch_row($result);}
print "<br>$line[0]";
mysql_close($link);
?>
<?php
include "connectdatabase.php";
include "init.inc.php";
$link=mysql_connect($hostname, $username, $password);
mysql_select_db($dbid) or die("unable to connect");
$result=mysql_query("SELECT ribbinflowprice FROM ribbinflower2");
for ($i = 0; $i < mysql_num_rows($result); ++$i)
{$line = mysql_fetch_row($result);}
print "<br>$line[0]";
mysql_close($link);
?>

จากภาพเราต้องการให้นำค่า 300 บรรทัดแรกมาบวกกับค่า 50คูณกับ 5 แล้วบรรทัดอื่นๆ ก็เอามาบวกกันตามลำดับอะค่ะ
ก็เป็น 300+ (50*5)+50+50+0 แล้วแสดงผลลัพธ์ออกมาใส่ใน textbox ต่อไป อะค่ะ
ขอบคุณเพื่อนๆพี่ๆน้องๆมากๆนะค่ะ ที่ช่วยเหลือค่ะ
N'Jew
Tag : - - - -
|
|
 |
 |
 |
 |
Date :
2009-12-12 23:17:06 |
By :
jew |
View :
2221 |
Reply :
3 |
|
 |
 |
 |
 |
|
|
|
 |