thara Posted June 25, 2012 Share Posted June 25, 2012 hi.. everyone.. This is a sql query problem that I have uncounted and have been in the same script for hours. But Still I couldn't get it to work. I need to 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 and if its match with one of a value in database then query can retrieve one row. This is my designation array. its value I use for image type in my db. $designation = array ( 'Managing Director', 'Manager', 'Director', 'The Principal', 'Deputy Principal', 'Proprietor', 'Assistant Manager', 'Head Master'); My problem is how can I check these value exit in my table and how can I make a query for this. In query where condition is confusing to me... any comments are greatly appreciated. Thank you.. Link to comment Share on other sites More sharing options...
Edward Posted June 25, 2012 Share Posted June 25, 2012 Have you read the PHP and MySQL for Dynamic Web Sites 4th Edition book by Larry? Link to comment Share on other sites More sharing options...
thara Posted June 25, 2012 Author Share Posted June 25, 2012 I have read it half. (till 7 chapter) .. why is it?? Link to comment Share on other sites More sharing options...
Antonio Conte Posted June 25, 2012 Share Posted June 25, 2012 Would like some more info. What's the use for this? What's the context. We can't really guess what you want to achieve. The reason I ask is because I'm thinking you begin in the wrong end. Please also describe your table structure. Link to comment Share on other sites More sharing options...
thara Posted June 25, 2012 Author Share Posted June 25, 2012 thanx for response. My table is institute_images and it has image_id, image_name, image_type, institute_id coloumns. designation array's values I use for image_type values. In my query I need to check is there any images in db with image_type value is one of my designation array's value. Link to comment Share on other sites More sharing options...
Edward Posted June 25, 2012 Share Posted June 25, 2012 I have read it half. (till 7 chapter) .. why is it?? Well i think if you did read, understand and finished this book most of your questions would be answered. I would suggest to anyone that before they began to develop stuff that they at least had the basics in their pocket. Link to comment Share on other sites More sharing options...
margaux Posted June 25, 2012 Share Posted June 25, 2012 You could get the column from the d/b that you need and use in_array to check against your designation array. Link to comment Share on other sites More sharing options...
thara Posted June 26, 2012 Author Share Posted June 26, 2012 Thanks for all answers.... I got a solution using IN() in mysql... thanks again.. Link to comment Share on other sites More sharing options...
Recommended Posts