Jump to content

SQL query Problem..


thara

Recommended Posts

hi.. every one.

 

I have a problem with a logic. this is it.....

I need select an one row from the database. when retrieving data sql query need to check some image type. That mean, I have these values 'Director, Manager, Principal etc.' and those value I used as image type in my database. Actually I need to get a image from db after matching its type.

 

I try to do it like this...

 

	$q = "SELECT image_id FROM institute_images 
		 WHERE institute_id = $instituteId AND image_type = " . 

	// Make the designaton array for check Image Type:
	$desig = array ( 'Managing Director', 'Manager', 'Director', 'The Principal', 'Deputy Principal', 'Proprietor', 'Assistant Manager', 'Head Master');	 

	$imageType = false;	 

	// check that file is of an permitted MIME type
	foreach ($desig as $type) {
		if ($type ) {
			$imageType = true;
			break;
		}
	}	 

	$r = mysqli_query ( $dbc, $q );			
	$numRows = mysqli_num_rows($r);

	if ( $numRows == 0) { 

 

 

it is little bit confusing me.. can anybody help me to fix this problem...

 

thank you

Link to comment
https://forums.phpfreaks.com/topic/264723-sql-query-problem/
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.