Solved

Expand MySQL query in PHP code

Posted on 2011-09-29
1
330 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 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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

This article describes how to use the timestamp of existing data in a database to allow Tableau to calculate the prior work day instead of relying on case statements or if statements to calculate the days of the week.
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
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…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

713 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