if($bright==1){
if($weight==1){
$query=mysql_query("SELECT * from product WHERE projec_sys like '%$projec%' && resolution like '%$resolution%' && bright between 1 and 2000 && weight between 0 and 1.00");
while($arr_product=mysql_fetch_array($query)){
echo $arr_product['name'].'<br>';
}
}
elseif($weight==2){
$query=mysql_query("SELECT * from product WHERE projec_sys like '%$projec%' && resolution like '%$resolution%' && bright between 1 and 2000 && weight between 1.01 and 2.00");
while($arr_product=mysql_fetch_array($query)){
echo $arr_product['name'].'<br>';
}
}
elseif($weight==3){
$query=mysql_query("SELECT * from product WHERE projec_sys like '%$projec%' && resolution like '%$resolution%' && bright between 1 and 2000 && weight between 2.01 and 3.00");
while($arr_product=mysql_fetch_array($query)){
echo $arr_product['name'].'<br>';
}
}
elseif($weight==4){
$query=mysql_query("SELECT * from product WHERE projec_sys like '%$projec%' && resolution like '%$resolution%' && bright between 1 and 2000 && weight between 3.01 and 4.00");
while($arr_product=mysql_fetch_array($query)){
echo $arr_product['name'].'<br>';
}
}
elseif($weight==5){
$query=mysql_query("SELECT * from product WHERE projec_sys like '%$projec%' && resolution like '%$resolution%' && bright between 1 and 2000 && weight between 4.01 and 5.00");
while($arr_product=mysql_fetch_array($query)){
echo $arr_product['name'].'<br>';
}
}
else{
$query=mysql_query("SELECT * from product WHERE projec_sys like '%$projec%' && resolution like '%$resolution%' && bright between 1 and 2000");
while($arr_product=mysql_fetch_array($query)){
echo $arr_product['name'].'<br>';
}
}
}
elseif($bright==2){
if($weight==1){
$query=mysql_query("SELECT * from product WHERE projec_sys like '%$projec%' && resolution like '%$resolution%' && bright between 2001 and 3000 && weight between 0 and 1.00");
while($arr_product=mysql_fetch_array($query)){
echo $arr_product['name'].'<br>';
}
}
elseif($weight==2){
$query=mysql_query("SELECT * from product WHERE projec_sys like '%$projec%' && resolution like '%$resolution%' && bright between 2001 and 3000 && weight between 1.01 and 2.00");
while($arr_product=mysql_fetch_array($query)){
echo $arr_product['name'].'<br>';
}
}
elseif($weight==3){
$query=mysql_query("SELECT * from product WHERE projec_sys like '%$projec%' && resolution like '%$resolution%' && bright between 2001 and 3000 && weight between 2.01 and 3.00");
while($arr_product=mysql_fetch_array($query)){
echo $arr_product['name'].'<br>';
}
}
elseif($weight==4){
$query=mysql_query("SELECT * from product WHERE projec_sys like '%$projec%' && resolution like '%$resolution%' && bright between 2001 and 3000 && weight between 3.01 and 4.00");
while($arr_product=mysql_fetch_array($query)){
echo $arr_product['name'].'<br>';
}
}
elseif($weight==5){
$query=mysql_query("SELECT * from product WHERE projec_sys like '%$projec%' && resolution like '%$resolution%' && bright between 2001 and 3000 && weight between 4.01 and 5.00");
while($arr_product=mysql_fetch_array($query)){
echo $arr_product['name'].'<br>';
}
}
else{
$query=mysql_query("SELECT * from product WHERE projec_sys like '%$projec%' && resolution like '%$resolution%' && bright between 2001 and 3000");
while($arr_product=mysql_fetch_array($query)){
echo $arr_product['name'].'<br>';
}
}
}
elseif($bright==3){
if($weight==1){
$query=mysql_query("SELECT * from product WHERE projec_sys like '%$projec%' && resolution like '%$resolution%' && bright between 3001 and 4000 && weight between 0 and 1.00");
while($arr_product=mysql_fetch_array($query)){
echo $arr_product['name'].'<br>';
}
}
elseif($weight==2){
$query=mysql_query("SELECT * from product WHERE projec_sys like '%$projec%' && resolution like '%$resolution%' && bright between 3001 and 4000 && weight between 1.01 and 2.00");
while($arr_product=mysql_fetch_array($query)){
echo $arr_product['name'].'<br>';
}
}
elseif($weight==3){
$query=mysql_query("SELECT * from product WHERE projec_sys like '%$projec%' && resolution like '%$resolution%' && bright between 3001 and 4000 && weight between 2.01 and 3.00");
while($arr_product=mysql_fetch_array($query)){
echo $arr_product['name'].'<br>';
}
}
elseif($weight==4){
$query=mysql_query("SELECT * from product WHERE projec_sys like '%$projec%' && resolution like '%$resolution%' && bright between 3001 and 4000 && weight between 3.01 and 4.00");
while($arr_product=mysql_fetch_array($query)){
echo $arr_product['name'].'<br>';
}
}
elseif($weight==5){
$query=mysql_query("SELECT * from product WHERE projec_sys like '%$projec%' && resolution like '%$resolution%' && bright between 3001 and 4000 && weight between 4.01 and 5.00");
while($arr_product=mysql_fetch_array($query)){
echo $arr_product['name'].'<br>';
}
}
else{
$query=mysql_query("SELECT * from product WHERE projec_sys like '%$projec%' && resolution like '%$resolution%' && bright between 3001 and 4000");
while($arr_product=mysql_fetch_array($query)){
echo $arr_product['name'].'<br>';
}
}
}
elseif($bright==4){
if($weight==1){
$query=mysql_query("SELECT * from product WHERE projec_sys like '%$projec%' && resolution like '%$resolution%' && bright between 4001 and 5000 && weight between 0 and 1.00");
while($arr_product=mysql_fetch_array($query)){
echo $arr_product['name'].'<br>';
}
}
elseif($weight==2){
$query=mysql_query("SELECT * from product WHERE projec_sys like '%$projec%' && resolution like '%$resolution%' && bright between 4001 and 5000 && weight between 1.01 and 2.00");
while($arr_product=mysql_fetch_array($query)){
echo $arr_product['name'].'<br>';
}
}
elseif($weight==3){
$query=mysql_query("SELECT * from product WHERE projec_sys like '%$projec%' && resolution like '%$resolution%' && bright between 4001 and 5000 && weight between 2.01 and 3.00");
while($arr_product=mysql_fetch_array($query)){
echo $arr_product['name'].'<br>';
}
}
elseif($weight==4){
$query=mysql_query("SELECT * from product WHERE projec_sys like '%$projec%' && resolution like '%$resolution%' && bright between 4001 and 5000 && weight between 3.01 and 4.00");
while($arr_product=mysql_fetch_array($query)){
echo $arr_product['name'].'<br>';
}
}
elseif($weight==5){
$query=mysql_query("SELECT * from product WHERE projec_sys like '%$projec%' && resolution like '%$resolution%' && bright between 4001 and 5000 && weight between 4.01 and 5.00");
while($arr_product=mysql_fetch_array($query)){
echo $arr_product['name'].'<br>';
}
}
else{
$query=mysql_query("SELECT * from product WHERE projec_sys like '%$projec%' && resolution like '%$resolution%' && bright between 4001 and 5000");
while($arr_product=mysql_fetch_array($query)){
echo $arr_product['name'].'<br>';
}
}
}
else{
if($weight==1){
$query=mysql_query("SELECT * from product WHERE projec_sys like '%$projec%' && resolution like '%$resolution%' && weight between 0 and 1.00");
while($arr_product=mysql_fetch_array($query)){
echo $arr_product['name'].'<br>';
}
}
elseif($weight==2){
$query=mysql_query("SELECT * from product WHERE projec_sys like '%$projec%' && resolution like '%$resolution%' && weight between 1.01 and 2.00");
while($arr_product=mysql_fetch_array($query)){
echo $arr_product['name'].'<br>';
}
}
elseif($weight==3){
$query=mysql_query("SELECT * from product WHERE projec_sys like '%$projec%' && resolution like '%$resolution%' && weight between 2.01 and 3.00");
while($arr_product=mysql_fetch_array($query)){
echo $arr_product['name'].'<br>';
}
}
elseif($weight==4){
$query=mysql_query("SELECT * from product WHERE projec_sys like '%$projec%' && resolution like '%$resolution%' && weight between 3.01 and 4.00");
while($arr_product=mysql_fetch_array($query)){
echo $arr_product['name'].'<br>';
}
}
elseif($weight==5){
$query=mysql_query("SELECT * from product WHERE projec_sys like '%$projec%' && resolution like '%$resolution%' && weight between 4.01 and 5.00");
while($arr_product=mysql_fetch_array($query)){
echo $arr_product['name'].'<br>';
}
}
else{
$query=mysql_query("SELECT * from product WHERE projec_sys like '%$projec%' && resolution like '%$resolution%'");
while($arr_product=mysql_fetch_array($query)){
echo $arr_product['name'].'<br>';
}
}
}
search_pro.php
<?
if($bright==1){ $bright2=" and (bright between 1 and 2000 )"}
if($bright==2){ $bright2=" and (bright between 2001 and 3000 )"}
if($bright==3){ $bright2=" and (bright between 3001 and 4000 )"}
if($bright==4){ $bright2=" bright (between 4001 and 5000 )"}
if($weight==1){$weight2=" and (weight between 0 and 1.00 ) "}
if($weight==2{$weight2=" and (weight between 1.01 and 2.00 ) "}
if($weight==3{$weight2=" and (weight between 2.01 and 3.00 ) "}
if($weight==4{$weight2=" and (weight between 3.01 and 4.00 )"}
if($weight==5{$weight2=" and (weight between 4.01 and 5.00 )"}
$query=mysql_query("SELECT * from product WHERE projec_sys like '%".$projec."%' and resolution like '%".$resolution."%' ".$bright2." ".$weight2." ");
while($arr_product=mysql_fetch_array($query)){
echo $arr_product['name'].'<br>';
}
if($bright==1){ $bright2=" and ";}
if($bright==2){ $bright2=" and bright between 1 and 2000";}
if($bright==3){ $bright2=" and bright between 2001 and 3000";}
if($bright==4){ $bright2=" and bright between 3001 and 4000";}
if($bright==5){ $bright2=" and bright between 4001 and 5000";}
if($weight==1){$weight2=" and ";}
if($weight==2){$weight2=" and weight between 0 and 1.00";}
if($weight==3){$weight2=" and weight between 1.01 and 2.00";}
if($weight==4){$weight2=" and weight between 2.01 and 3.00";}
if($weight==5){$weight2=" and weight between 3.01 and 4.00";}
if($weight==6){$weight2=" and weight between 4.01 and 5.00";}
$query=mysql_query("SELECT * from product WHERE projec_sys like '%".$projec."%' and resolution like '%".$resolution."%' ".$bright2." ".$weight2." ");
while($arr_product=mysql_fetch_array($query)){
echo $arr_product['name'].'<br>';
}
ทำแบบนี้นะค่ะ แล้วมันขึ้น error ว่า
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\AppServ\www\thaibiz_project\search_pro.php on line 37
บรรทัดที่เป็น $query นะค่ะ
พอดีลืมบอกไปค่ะว่าจะมีค่าว่างด้วย ตอนนี้ให้เป็น 1 ค่ะ ของแต่ละ list box