 |
เกิด error Query was empty รบกวนด้วย ครับ ไม่รู้ เกิดจากอะไร ครับ |
|
 |
|
|
 |
 |
|
Code (PHP)
$spp1= mysql_query("SELECT count(order_generation) AS V_TOTAL1 , SUM(size_new) AS V_TOTAL , check_status , order_ID FROM genneration_size
WHERE check_status='0' or check_status='1' or check_status='2' AND order_generation IN ('ASD', 'CSD', 'HRG', 'LBG', 'LSD', 'OBD', 'PFR', 'RAL', 'WSG', '$hdata')
GROUP BY order_generation");
while($spp1_row = mysql_fetch_array($spp1)){
$rs_menu = mysql_query("SELECT count(order_generation) AS V_TOTAL_new1 , SUM(size_new) AS V_TOTAL_new , check_status , order_ID FROM genneration_size
WHERE check_status!='2' AND order_ID = ".$spp1_row['order_ID']." AND order_generation IN ('ASD', 'CSD', 'HRG', 'LBG', 'LSD', 'OBD', 'PFR', 'RAL', 'WSG', '$hdata
GROUP BY order_generation");
$qu1=mysql_query($rs_menu) or die(mysql_error());
while($arr1=mysql_fetch_array($qu1)){
$order_generation=$arr1['order_generation'];
$check_status=$arr1['check_status'];
$order_ID=$arr1['order_ID'];
$data1= $arr1[V_TOTAL]."<br>";
$data2 = $arr1[V_TOTAL1]."<br>";
$data3= $arr1[V_TOTAL_new]."<br>";
$data4 = $arr1[V_TOTAL_new1]."<br>";
// $data_sum=$arr[V_TOTAL_new] * $arr1[V_TOTAL] ."<br>";
//echo $data_sum."<br>";
}
}
Tag : PHP
|
|
 |
 |
 |
 |
Date :
2013-03-21 11:06:07 |
By :
TonsoR |
View :
1657 |
Reply :
6 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Quote: $rs_menu = mysql_query("SELECT count(order_generation) AS V_TOTAL_new1 , SUM(size_new) AS V_TOTAL_new , check_status , order_ID FROM genneration_size
WHERE check_status!='2' AND order_ID = ".$spp1_row['order_ID']." AND order_generation IN ('ASD', 'CSD', 'HRG', 'LBG', 'LSD', 'OBD', 'PFR', 'RAL', 'WSG', '$hdata
GROUP BY order_generation");
$qu1=mysql_query($rs_menu) or die(mysql_error());
ทำไมถึง Query 2 รอบครับ
|
 |
 |
 |
 |
Date :
2013-03-21 11:11:36 |
By :
mr.win |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
เพราะผม อยากเอา ค่า V_TOTAL1 จาก การ select ครั้งแรก มาคูณกับ V_TOTAL_new ใน การ select รอบที่สอง โดยมีเงื่อนไขว่า
select รอบ แรก WHERE check_status='0' or check_status='1' or check_status='2'
select รอบ 2 WHERE check_status!='2'
ไม่ทราบว่า พอมีวิธี ไหน ที่พอ แนะนำได้รึเปล่า ครับ ผม ทำ มา หลายวันแล้ว ครับ
|
 |
 |
 |
 |
Date :
2013-03-21 11:20:39 |
By :
TonsoR |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
เห็นมั้ยครับ คุณมีการกำหนดค่าให้กับ $rs_menu
$rs_menu = mysql_query(...
แล้วหลังจากนั้นคุณก็เอา $rs_menu ไปเป็น query
$qu1=mysql_query($rs_menu) or die(mysql_error());
ซึ่ง $rs_menu คงมีค่าเป็น false ตั้งแต่ query ครั้งแรกแล้ว
ดังนั้น query ครั้งแรก มี error แน่นอน (ยังไม่ต้องพูดถึงครั้งที่สอง)
|
 |
 |
 |
 |
Date :
2013-03-21 11:48:03 |
By :
cookiephp |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ครับ ขอบ คุณ มาก ครับ พี่
|
 |
 |
 |
 |
Date :
2013-03-21 13:40:37 |
By :
TonsoR |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
2 ตัวนี้ รัน ออก ครับ ติดที่ไม่สามาถเอาโค๊ดที่ select ทั้งสองครั้งนี้มาเชื่อมกันได้ ครับ เชื่อมตามตัวนี้ ครับ
'ASD', 'CSD', 'HRG', 'LBG', 'LSD', 'OBD', 'PFR', 'RAL', 'WSG'

Code (PHP)
SELECT count(order_generation) AS V_TOTAL1 , SUM(size_new) AS V_TOTAL , check_status , order_ID FROM genneration_size
WHERE check_status='0' or check_status='1' or check_status='2' AND order_generation IN ('ASD', 'CSD', 'HRG', 'LBG', 'LSD', 'OBD', 'PFR', 'RAL', 'WSG', '$hdata')
GROUP BY order_generation

Code (PHP)
SELECT count(order_generation) AS V_TOTAL_new1 , SUM(size_new) AS V_TOTAL_new , check_status , order_ID FROM genneration_size
WHERE check_status='0' or check_status='1' AND order_generation IN ('ASD', 'CSD', 'HRG', 'LBG', 'LSD', 'OBD', 'PFR', 'RAL', 'WSG', '$hdata')
GROUP BY order_generation
|
ประวัติการแก้ไข 2013-03-22 09:08:58 2013-03-22 09:14:06
 |
 |
 |
 |
Date :
2013-03-22 09:06:58 |
By :
TonsoR |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|