Jump to content

Recommended Posts

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?

Link to comment
https://forums.phpfreaks.com/topic/258994-function-not-displaying/
Share on other sites

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.

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.

post-131124-13482403317015_thumb.png

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.