 |
ช่วยดูโค้ดนี้ให้หน่อยครับมันผิดตรงไหน นั่งงงตั้งนานจนปัญญาแล้ว |
|
 |
|
|
 |
 |
|
ตารางที่เก็บข้อมูลนี้มีคีย์หลักอะไรหรอครับ ผมคิดว่าถ้า where โดยคีย์หลักของตารางน่าจะโอเคกว่า where make = 'กลุ่ม 150 หลัง' นะครับ
|
 |
 |
 |
 |
Date :
2011-07-24 18:34:19 |
By :
arm8957 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (PHP)
<?php
//SELECT host_dis, make, count( host_dis ) FROM host GROUP BY TYPE LIMIT 0 , 30 // ลองทำใน db
$query = "SELECT host_dis, make, count( host_dis ) FROM host GROUP BY TYPE";
$result = mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_array($result)){
$aumper = $row['host_dis'];
$num = $row['count( host_dis )'];
$make = $row['make'];
?>
ไม่รู้จะใช่แบบนี้หรือเปล่า ผลที่ได้คือ
- อำเภอพุนพิน จำนวน 2 หลัง และอยู่ใน กลุ่ม 150 หลัง
- อำเภอชัยบุรี จำนวน 1 หลัง และอยู่ใน กลุ่ม 212 หลัง
- อำเภอไชยา จำนวน 2 หลัง และอยู่ใน กลุ่ม 150 หลัง
|
 |
 |
 |
 |
Date :
2011-07-24 20:39:52 |
By :
nisithost.com |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
$query = "SELECT make,host_dis, COUNT(type),COUNT(host_dis),COUNT(make) FROM host where make = 'กลุ่ม 150 หลัง' GROUP BY host_dis ";
$result = mysql_query($query) or die(mysql_error());
|
 |
 |
 |
 |
Date :
2011-07-25 04:07:19 |
By :
sakuraei |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|