Help!php Posted March 15, 2012 Share Posted March 15, 2012 I have conducted a query which should work but its not. Is there any error with this query. if ( isset( $_GET[ 'rrpmin' ] ) && isset( $_GET[ 'rrpmax' ] ) ) { foreach( $_GET as $k => $v ) { switch( strtolower( $k ) ) { case "ethernet": case "usb": case "parallel": if ( $v == "1" ) $qryParams .= "not isnull(`printers`.`{$k}`) AND length(`printers`.`{$k}`) > 0 AND `printers`.`{$k}` NOT LIKE 'no' AND "; break; case "duplex": if ( $v == "1" ) $qryParams .= "not isnull(`printers`.`duplex`) AND length(`printers`.`duplex`) > 0 AND `printers`.`duplex` NOT LIKE 'no' AND `printers`.`duplex` NOT LIKE '%manual%' AND "; break; case "A3": case "A4": if ( $v == "1" ) $qryParams .= "format LIKE '%{$k}%' AND "; break; case "windows": case "mac": if ( $v == "1" ) $qryParams .= "platform LIKE '%{$k}%' AND "; break; case "format": case "category": $qryParams .= "{$k}='{$v}' AND "; break; case "wireless": if ( $v == "1" ) $qryParams .= "name like '%w' AND "; break; } } The whole thing worked until I added case "A3": case "A4": if ( $v == "1" ) $qryParams .= "format LIKE '%{$k}%' AND "; break; This case is not working and I was wondering why? Quote Link to comment https://forums.phpfreaks.com/topic/258994-function-not-displaying/ Share on other sites More sharing options...
AyKay47 Posted March 15, 2012 Share Posted March 15, 2012 What do you mean by "it's not working"? What exactly is happening. As far as I can tell, the switch is fine, although I can tell you right now that the query won't work when it's built, because you are mixing PHP functions into the query without concatenation. Quote Link to comment https://forums.phpfreaks.com/topic/258994-function-not-displaying/#findComment-1327725 Share on other sites More sharing options...
Help!php Posted March 15, 2012 Author Share Posted March 15, 2012 I have a checkbox with A3 and A4 and other options. All the other one works besides A3 and A4. Because of the query or whatever. I dont know. I have attched an image of the checkbox. A3 and A4 wont work and this checkbox is created using javascript and its not my code. Some intern did it and I have to work on it and I am not sure. Quote Link to comment https://forums.phpfreaks.com/topic/258994-function-not-displaying/#findComment-1327730 Share on other sites More sharing options...
AyKay47 Posted March 15, 2012 Share Posted March 15, 2012 You are using strtolower() for the switch comparison. So you need to compare 'a3' and 'a4' not 'A3' and 'A4' Quote Link to comment https://forums.phpfreaks.com/topic/258994-function-not-displaying/#findComment-1327745 Share on other sites More sharing options...
Help!php Posted March 15, 2012 Author Share Posted March 15, 2012 I have another issue. You know where it shows 531 result. When I click show result it doesnt show anything. Quote Link to comment https://forums.phpfreaks.com/topic/258994-function-not-displaying/#findComment-1327751 Share on other sites More sharing options...
AyKay47 Posted March 15, 2012 Share Posted March 15, 2012 My mind reading skills are off today, Make another thread for this, showing the relevant code and the issue. Quote Link to comment https://forums.phpfreaks.com/topic/258994-function-not-displaying/#findComment-1327757 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.