Hi all,
I'm trying to perform a single query to the db, in which I am using an array of IDs to insert in the WHERE clause. So far I've had mixed results, and this is the closest I've gotten to achieve what I am looking for.
PHP Code:
require './auth.php';
$prodId = array(17754, 17755, 17756);
$ids = implode(",",$prodId);
$qry = "SELECT clean_url AS url FROM xcart_clean_urls WHERE resource_id IN ($ids) ";
$resultTst = db_query($qry);
while ($result_row = db_fetch_array($resultTst)) {
$urls[] = $result_row;
if ( $urls ) {
echo $urls[0]['url'] . '<br>';
echo $urls[1]['url'] . '<br>';
echo $urls[2]['url'] . '<br>';
}
}
THE RESULTS I GET (I get the actual urls):
urlforid17754
urlforid17754
urlforid17755
urlforid17754
urlforid17755
urlforid17756
How can I perform the same functionality, but only retrieve the 3 urls once?
Thank you all.
Serge