Jump to content

Two or more conditions in a where statement


Asheeown

Recommended Posts

I'm building a page for a customer to search every log from their ID.  When they login the ID is set to a session, However the customer may have two or more IDs so that sessions for example would be "000500,000501"  now what I want to do is search in the table "rated_cdrs" to match "000500" and "000501" to the column "Originating_TG" in that table, any idea on how to?
Since your ids are already separated by a comma, drop them in an [b]IN[/b]:

[code]
<pre>
<?php
$ids = array (
'1',
'1,2',
'1,2,3',
'111',
'111,222',
'111,222,333',
);
foreach ($ids as $id) {
echo "SELECT ... WHERE id IN ($id)<br>";
}
?>
</pre>
[/code]

Are the leading zeros important?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.