Solved

Expand MySQL query in PHP code

Posted on 2011-09-29
1
300 Views
Last Modified: 2012-05-12
I have the following code that contains a MySQL snippet.  How do I alter this query to use an OR statement for column CoListingAgentNumber as well as the ListingAGentNumber and use $member_ids you see below:

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

Open in new window

0
Comment
Question by:pda4me
1 Comment
 
LVL 74

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
ID: 36818983
I believe it could be:

$where_clause = "WHERE (ListingAgentNumber in (".implode(',',$member_ids).") OR CoListingAgentNumber in (".implode(',',$member_ids)."))";

Open in new window

0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

760 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now