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
Share on other sites

Actually I need get a image from database and its type should be one of a value from my $designation array. The query should check $designation array's value with database table and if its match with one of a value in database then query can retrieve one row.

Link to comment
Share on other sites

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.