Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Expand MySQL query in PHP code

Posted on 2011-09-29
1
Medium Priority
?
342 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 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

Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

Question has a verified solution.

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

This post contains step-by-step instructions for setting up alerting in Percona Monitoring and Management (PMM) using Grafana.
In this series, we will discuss common questions received as a database Solutions Engineer at Percona. In this role, we speak with a wide array of MySQL and MongoDB users responsible for both extremely large and complex environments to smaller singl…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

963 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