 |
ช่วยดูโคดการดิงวันที่จาก database ขื้นมาทำเป็นลายงานให้หน่อยนะคะ |
|
 |
|
|
 |
 |
|
ฉันขอโทษกับการเขียนภาษาไทยของฉัน
ฉันอาจเขียนคำบางผิดไปและทำให้คุณเกิดความเข้าใจผิดหรือไม่ชัดเจน
สันเป็นคนลาว
ฉันต้องการความช่วยเหลือบางอย่าง
ช่วยสันทีนะคะ
code
<?
include "connect.php";
$query = "SELECT sale_day, count(id) FROM salelao where place='$place' and sale_country='Lao' GROUP BY sale_day";
$query4 = "SELECT sale_day, count(id) FROM sale where place='$place' and sale_country='Allemagne' GROUP BY sale_day";
$query5 = "SELECT sale_day, count(id) FROM sale where place='$place' and sale_country='Europe' GROUP BY sale_day";
$query7 = "SELECT sale_day, count(id) FROM sale where place='$place' and sale_country='Chinese' GROUP BY sale_day";
$query11 = "SELECT sale_day, count(id) FROM sale where place='$place' and sale_country='Autre' GROUP BY sale_day";
$result = mysql_query($query) or die(mysql_error());
$result4 = mysql_query($query4) or die(mysql_error());
$result5 = mysql_query($query5) or die(mysql_error());
$result7 = mysql_query($query7) or die(mysql_error());
$result11 = mysql_query($query11) or die(mysql_error());
echo "
<table bordercolorlight='#000000' border='' align='center'>
<tr>
<th colspan='16' valign='middle'><font size='4'><b><center>การติดตามคนเข้าชม</center></b></font></th>
</tr>
<tr align='center'>
<td>Dates</td>
<td>Lao</td>
<td>ຝຣັ່France </td>
<td>Italian</td>
<td>Espagne</td>
<td>Allemagne</td>
<td>Reste de l'Europe</td>
<td>Etats-Unis</td>
<td>Chinese</td>
<td>Vietnam</td>
<td>Japan</td>
<td>Thailand</td>
<td>Autre</td>
<td>Total Visiters</td>
<td>Recettes</td>
<td>Remarques</td>
</tr>
";
while($row = mysql_fetch_array($result) and $row4 = mysql_fetch_array($result4) and $row5 = mysql_fetch_array($result5) and $row7 = mysql_fetch_array($result7) and $row11 = mysql_fetch_array($result11)){
$sale_day = $row['sale_day'];
$count = $row['count(id)'];
$count4 = $row4['count(id)'];
$count5 = $row5['count(id)'];
$count7 = $row7['count(id)'];
$count11 = $row11['count(id)'];
echo "
<tr>
<td align=center>$sale_day</td>
<td align=center>$count</td>
<td align=center>$count1</td>
<td align=center>$count2</td>
<td align=center>$count3</td>
<td align=center>$count4</td>
<td align=center>$count5</td>
<td align=center>$count6</td>
<td align=center>$count7</td>
<td align=center>$count8</td>
<td align=center>$count9</td>
<td align=center>$count10</td>
<td align=center>$count11</td>
<td>ลาว.
<br />ชาวต่างชาติ. </td>
<td></td>
<td></td>
</tr>
";
}
?>
database
CREATE TABLE `sale` (
`id` int(11) NOT NULL auto_increment,
`sale_day` date NOT NULL,
`sale_month` date NOT NULL,
`sale_pice` varchar(15) NOT NULL,
`sale_country` varchar(255) NOT NULL,
`place` varchar(50) NOT NULL,
`FilesName` varchar(100) NOT NULL,
`id_no` int(6) unsigned zerofill NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=10 ;
--
-- Dumping data for table `sale`
--
INSERT INTO `sale` VALUES (1, '2011-11-14', '2011-11-14', '30,000', 'Chinese', 'vathorpakheo', '1.jpg', 000001);
INSERT INTO `sale` VALUES (2, '2011-11-14', '2011-11-14', '30,000', 'Japan', 'vathorpakheo', '4a6856e2462772f68ddb0.jpg', 000002);
INSERT INTO `sale` VALUES (3, '2011-11-14', '2011-11-14', '30,000', '', 'vathorpakheo', '090324085424c00975c203b08c.jpg', 000003);
INSERT INTO `sale` VALUES (4, '2011-11-14', '2011-11-14', '30,000', 'Chinese', 'tardsae', '200812069e9e7aa8ad787be.jpg', 000001);
INSERT INTO `sale` VALUES (5, '2011-11-14', '2011-11-14', '30,000', 'Chinese', 'tardsae', '00044581.jpg', 000002);
INSERT INTO `sale` VALUES (6, '2011-11-15', '2011-11-15', '30,000', 'Autre', 'tardsae', '0904181231defa62be39752.jpg', 000003);
INSERT INTO `sale` VALUES (7, '2011-11-15', '2011-11-15', '30,000', 'Europe', 'tardsae', '20070213a6524f21c416f98eu1.jpg', 000004);
INSERT INTO `sale` VALUES (8, '2011-11-15', '2011-11-15', '30,000', 'Allemagne', 'tardsae', '102245045.jpg', 000005);
INSERT INTO `sale` VALUES (9, '2011-11-15', '2011-11-15', '30,000', 'Chinese', 'tardsae', 'images (20).jpg', 000006);
CREATE TABLE `salelao` (
`id` int(11) NOT NULL auto_increment,
`sale_day` date NOT NULL,
`sale_month` date NOT NULL,
`sale_pice` varchar(15) NOT NULL,
`sale_country` varchar(255) NOT NULL,
`place` varchar(50) NOT NULL,
`FilesName` varchar(100) NOT NULL,
`id_no` int(6) unsigned zerofill NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ;
--
-- Dumping data for table `salelao`
--
INSERT INTO `salelao` VALUES (1, '2011-11-14', '2011-11-14', '3,000', 'Lao', 'tardsae', '876445.jpg', 000001);
INSERT INTO `salelao` VALUES (2, '2011-11-14', '2011-11-14', '3,000', 'Lao', 'tardsae', 'c127on2.jpg', 000002);
ผนการเขียนโคด

แต่บันหาก่อคื มันจะมี select option ให้เลือกอยู่ทังหมด 12 ลายการ แล้วโคดทังหมดมันก่อจะเป็น
code
<?
include "connect.php";
$query = "SELECT sale_day, count(id) FROM salelao where place='$place' and sale_country='Lao' GROUP BY sale_day";
$query1 = "SELECT sale_day, count(id) FROM sale where place='$place' and sale_country='France' GROUP BY sale_day";
$query2 = "SELECT sale_day, count(id) FROM sale where place='$place' and sale_country='Italian' GROUP BY sale_day";
$query3 = "SELECT sale_day, count(id) FROM sale where place='$place' and sale_country='Espagne' GROUP BY sale_day";
$query4 = "SELECT sale_day, count(id) FROM sale where place='$place' and sale_country='Allemagne' GROUP BY sale_day";
$query5 = "SELECT sale_day, count(id) FROM sale where place='$place' and sale_country='Europe' GROUP BY sale_day";
$query6 = "SELECT sale_day, count(id) FROM sale where place='$place' and sale_country='Etats-Unis' GROUP BY sale_day";
$query7 = "SELECT sale_day, count(id) FROM sale where place='$place' and sale_country='Chinese' GROUP BY sale_day";
$query8 = "SELECT sale_day, count(id) FROM sale where place='$place' and sale_country='Vietnam' GROUP BY sale_day";
$query9 = "SELECT sale_day, count(id) FROM sale where place='$place' and sale_country='Japan' GROUP BY sale_day";
$query10 = "SELECT sale_day, count(id) FROM sale where place='$place' and sale_country='Thailand' GROUP BY sale_day";
$query11 = "SELECT sale_day, count(id) FROM sale where place='$place' and sale_country='Autre' GROUP BY sale_day";
$result = mysql_query($query) or die(mysql_error());
$result1 = mysql_query($query1) or die(mysql_error());
$result2 = mysql_query($query2) or die(mysql_error());
$result3 = mysql_query($query3) or die(mysql_error());
$result4 = mysql_query($query4) or die(mysql_error());
$result5 = mysql_query($query5) or die(mysql_error());
$result6 = mysql_query($query6) or die(mysql_error());
$result7 = mysql_query($query7) or die(mysql_error());
$result8 = mysql_query($query8) or die(mysql_error());
$result9 = mysql_query($query9) or die(mysql_error());
$result10 = mysql_query($query10) or die(mysql_error());
$result11 = mysql_query($query11) or die(mysql_error());
echo "
<table bordercolorlight='#000000' border='' align='center'>
<tr>
<th colspan='16' valign='middle'><font size='4'><b><center>การติดตามคนเข้าชม</center></b></font></th>
</tr>
<tr align='center'>
<td>Dates</td>
<td>Lao</td>
<td>France </td>
<td>Italian</td>
<td>Espagne</td>
<td>Allemagne</td>
<td>Reste de l'Europe</td>
<td>Etats-Unis</td>
<td>Chinese</td>
<td>Vietnam</td>
<td>Japan</td>
<td>Thailand</td>
<td>Autre</td>
<td>Total Visiters</td>
<td>Recettes</td>
<td>Remarques</td>
</tr>
";
while($row = mysql_fetch_array($result) and $row1 = mysql_fetch_array($result1) and $row2 = mysql_fetch_array($result2) and $row3 = mysql_fetch_array($result3) and $row4 = mysql_fetch_array($result4) and $row5 = mysql_fetch_array($result5) and $row6 = mysql_fetch_array($result6) and $row7 = mysql_fetch_array($result7) and $row8 = mysql_fetch_array($result8) and $row9 = mysql_fetch_array($result9) and $row10 = mysql_fetch_array($result10) and $row11 = mysql_fetch_array($result11)){
$sale_day = $row['sale_day'];
$count = $row['count(id)'];
$count1 = $row1['count(id)'];
$count2 = $row2['count(id)'];
$count3 = $row3['count(id)'];
$count4 = $row4['count(id)'];
$count5 = $row5['count(id)'];
$count6 = $row6['count(id)'];
$count7 = $row7['count(id)'];
$count8 = $row8['count(id)'];
$count9 = $row9['count(id)'];
$count10 = $row10['count(id)'];
$count11 = $row11['count(id)'];
echo "
<tr>
<td align=center>$sale_day</td>
<td align=center>$count</td>
<td align=center>$count1</td>
<td align=center>$count2</td>
<td align=center>$count3</td>
<td align=center>$count4</td>
<td align=center>$count5</td>
<td align=center>$count6</td>
<td align=center>$count7</td>
<td align=center>$count8</td>
<td align=center>$count9</td>
<td align=center>$count10</td>
<td align=center>$count11</td>
<td>ลาว.
<br />ชาวต่างชาติ. </td>
<td></td>
<td></td>
</tr>
";
}
?>
"อีงตามข้อมูนที่มี จะมีแค่ 5 ปะเทด" ทำให้เวลาสะแดงผน มัมไม่สะแดงอะไรออกมาเลีย ดั่งรูบ

กะรุนาช่วยแนะนำหน่อยนะคะ
คืยากจะให้มันเป็นแบบว่า สะแดงจำนวนคนตามวันที่ และ สะถานที่ ดั่งรูบ

ช่วยหน่อยนะคะ
ป.ล. มืคนเคียบอกให้แก้ที่
$query = "SELECT sale_day, count(id) FROM sale where place='$place' and sale_country='Chinese' GROUP BY sale_day";
try this one >> เป็น
$query = "SELECT sale_day, count(id) FROM sale where place='$place' and sale_country='Chinese' GROUP BY sale_day, count(id) ORDER BY sale_day";
แต่มันก่อยังไม่ได้ และ ยังฟ้องว่า "Invalid use of group function" อีกด้วย
HELP ME PLEASE 
ขอขอบคุณทุกคนล่วงหน้านะคะ
^/\^
Tag : PHP, MySQL
|
|
 |
 |
 |
 |
Date :
2011-11-21 16:41:19 |
By :
sweety^n^ |
View :
1020 |
Reply :
3 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ยาวมากอ่ะครับ..ลอง add mail มาครับ pokultra(add)hotเมล์.com
|
 |
 |
 |
 |
Date :
2011-11-21 17:14:24 |
By :
pokultra |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขอถามว่างานนี้รีบใช้ไหมครับ? ถ้าไม่รีบเดี๋ยววันเสาร์นี้ (26/11/2011)ผมจะไปเวียงจันทร์ จะไปแก้ให้
ผมก็คนลาวเหมือนกัน
หรือว่าอยู่ต่างแขวง??
ไม่งั้นก็ช่วยเซพรูปตารางที่เก็บข้อมูลมาให้ดูหน่อยครับ จะได้ตอบถูกหน่อย
ผมว่าสาเหตุที่มันไม่ออก น่าจะมาจากคุณ Select ผิด
ปล.แอด MSN มาคุยก็ได้ครับ [email protected]
|
 |
 |
 |
 |
Date :
2011-11-21 17:16:33 |
By :
iamatomix |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
สันอยู่เวียงจันทร์ นี้ละค่ะ
คืว่าส่ง mail ไปให้แล้วนะค่ะ
thanks for ur all help

|
 |
 |
 |
 |
Date :
2011-11-22 17:00:41 |
By :
sweety^n^ |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|