Here's the scenario, maybe someone can clear it up for me 🙂
I've a list of product ID's (from a session variable) which I've exploded into an array and am iterating through:
$shopping=explode(",",$sessionbasket);
$arylen=count($shopping);
for ($counter=0;$counter<$arylen;$counter++){
echo "<!-- $shopping[$counter]--><br>\n";
//difficult bit goes here
}
I'm more or less happy with this so far - it works 😉
Likewise, I'm satisfied that when I insert this query:
$result = mysql_query("SELECT * FROM specials where itemid='$shopping[$counter]'", $link_id);
within the loop, it executes - checked by echoing the sql statement. The problem arises when I insert the output loop:
while($query_data = mysql_fetch_row($result)) {
echo $query_data[1];
}
straight afterwards... I only get the first result returned. So, as an example, this would work as follows:
1) Shopping basket array contains [ab1,ab2,ab3]
2)Loop through the array passing [ab1] to the query.
3) Query returns data for ID ab1.
4) Back to step 2) using ab2
5) No data returned 🙁
Someone, please, tell me why this is happening and how to fix it!!
Ta.
LJ