figure 1. sum all value of money
id date name money //sample items only
1 March 5 2014 matt 50 //records to add
2 March 5 2014 john 10 //records to add
3 March 2 2014 matt 50 //records to add
figure 2. sum all value of money when search matt
id date name money //sample items only
1 March 5 2014 matt 50 //records to add
2 March 5 2014 john 10
3 March 2 2014 matt 50 //records to add
嗨,大家好,你能幫助我,我不知道該代碼如何在我的SQL數據庫中添加的行值。(見上面的例子)PHP總和Mysql的行數值的
我有這樣的代碼,這將算我有多少條記錄
<input type="text" name="namesearch" size="5" tabindex="1" />
<input type="submit" name='click' value='Search' />
if(isset($_POST['click'])){
$name= $_POST['namesearch'];
$query = "SELECT COUNT(*) AS total FROM table WHERE name='$name'";
$result = mysql_query($query);
$values = mysql_fetch_assoc($result);
$num_item= $values['total'];
echo "Number of Records Found # ".$num_item;
你在查詢試過嗎? – Zeeshan
mysql_num_rows($ result) – SajithNair