Jump to content

Why does my string return 0?


joesaddigh

Recommended Posts

Hi is there any reason why this string would return 0. I know that based on my search it is going into the various isset checks so should be being populated with my sql string.

 

The code is as follows.

 


// Facilities query
			$facilQuery = " AND ";

			if( $_SERVER['REQUEST_METHOD'] == "POST" ) 
			{
				 // Get the posted data
				 $_SESSION['country'] = $_POST["country"];
				 $_SESSION['region'] = $_POST["region"];
				 $_SESSION['town'] = $_POST["town"];
				 $_SESSION['weeks'] = $_POST["weeks"];
				 $_SESSION['coursetype'] = $_POST["Coursetype"];			

				 // Do all the checks for the facilities so that query can be dynamically generated

				 // Library
				 if ( isset( $_POST["library"] ) )
				 { 
					echo $facilQuery += "library = yes";
				 }

				 // Canteen
				 if ( isset( $_POST["cafecanteen"] ) )
				 { 
					$facilQuery += "OR cafecanteen = yes "; 
				 }

				 // Garden
				 if ( isset( $_POST["garden"] ) )
				 { 
					$facilQuery += "OR garden = yes ";
				 }

				 // Computer lab
				 if ( isset( $_POST["computer_lab"] ) )
				 { 
					$facilQuery += "OR computer_lab = yes ";
				 }

				 // Language Lab
				 if ( isset( $_POST["language_lab"] ) )
				 { 
					$facilQuery += "OR language_lab = yes ";
				 }

				 // Internet access
				 if ( isset( $_POST["internet_access"] ) )
				 { 
					$facilQuery += "OR internet_access = yes ";
				 }

				 // Self study centre
				 if ( isset( $_POST["self_study_center"] ) )
				 { 					 	
					$facilQuery += "OR self_study_center = yes ";
				 }

				 // Student lounge
				 if ( isset( $_POST["student_lounge"] ) )
				 { 
					$facilQuery += "OR student_lounge = yes ";
				 }

				 // Disabled access
				 if ( isset( $_POST["disabled_access"] ) )
				 { 
					$facilQuery += "OR disabled_access = yes ";
				 }

				 // Bookshop
				 if ( isset( $_POST["bookshop"] ) )
				 { 
					$facilQuery += "OR bookshop = yes ";
				 }

				 // Disabled access ac
				 if ( isset( $_POST["disabled_access_ac"] ) )
				 { 
					$facilQuery += "OR disabled_access_ac = yes ";
				 }
			}

			//if ( $facilQuery != " AND " )
			{
				echo $facilQuery;
			}

 

Thanks in advance

Link to comment
https://forums.phpfreaks.com/topic/207404-why-does-my-string-return-0/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.