thara Posted June 25, 2012 Share Posted June 25, 2012 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 More sharing options...
SurrealScripts Posted June 25, 2012 Share Posted June 25, 2012 Hey thara, Can you show us a structure of the database and an example of what you want to achieve? It should make it easier for me to understand what you want. Link to comment https://forums.phpfreaks.com/topic/264723-sql-query-problem/#findComment-1356762 Share on other sites More sharing options...
thara Posted June 25, 2012 Author Share Posted June 25, 2012 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 https://forums.phpfreaks.com/topic/264723-sql-query-problem/#findComment-1356766 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.