Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Expand MySQL query in PHP code

Posted on 2011-09-29
1
Medium Priority
?
339 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 2000 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

This article discusses how to implement server side field validation and display customized error messages to the client.
This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
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…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

704 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