?
Solved

php MYSQL query multiple options?

Posted on 2011-10-17
2
Medium Priority
?
181 Views
Last Modified: 2012-05-12
The below code creates a sql query based on a member_ids value.  I am trying to add an additional criteria so that it only displays records where the PROPERTY_TYPE_CODE is equal to S,D,B or M only but it is now returning all records?  What am I doing wrong?

<?php


$member_ids = explode(',',$mymemberid);
foreach ($member_ids as $i=>$val) $member_ids[$i]="'$val'";
$where_clause = "WHERE TLN_REALTOR_ID in (".implode(',',$member_ids).")";

// request query
mysql_select_db($database_Rets, $Rets);

$sql_query = "SELECT * FROM idx_Naples $where_clause AND PROPERTY_TYPE_CODE='S,D,B,M' ORDER BY RAND()";

Open in new window

0
Comment
Question by:pda4me
2 Comments
 
LVL 3

Accepted Solution

by:
clamps earned 2000 total points
ID: 36981523
try
... AND PROPERTY_TYPE_CODE IN ('S', 'D', 'B', 'M') ORDER BY RAND()";
0
 

Author Closing Comment

by:pda4me
ID: 36981593
Brilliant, thanks so much!!!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
Backups and Disaster RecoveryIn this post, we’ll look at strategies for backups and disaster recovery.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses
Course of the Month17 days, 6 hours left to enroll

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question