Forum Moderators: coopster
//Source
for($imageCount = 1; $imageCount <= 3; $imageCount ++){
$imageResult=mysql_query("SELECT * FROM dni_products WHERE prod_id='$product_id'");
$imageField=mysql_fetch_array($imageResult){
$imageRef="$imageField[prod_pic_".$imageCount."]";
if(($imageRef=="")OR($imageRef=="images/catalogue/noItem.gif")){
echo"<td valign=\"top\" align=\"center\"> </td>";
}else{
echo"<td valign=\"top\" align=\"center\"><div class=\"itemBGsV\" align=\"center\"><img src=\"images/main/spacer.gif\" width=\"1\" height=\"4\" border=\"0\"><br clear=\"all\"><a href=\"#\" onClick=\"MM_swapImage('singleSwap','','".$dirSub."images/catalogue/products/".$imageField[prod_id]."/large/".$imageField[prod_pic_".$imageCount."]."',1)\"><img src=\"images/catalogue/products/".$imageFieldield[prod_id]."/thumbs/".$imageField[prod_pic_$imageCount]."\" alt=\"".$imageField[prod_name]."\" width=\"55\" height=\"62\" border=\"0\"></a><br clear=\"all\"><img src=\"images/main/spacer.gif\" width=\"1\" height=\"4\" border=\"0\"><br clear=\"all\"></div></td>";
}
}
}
//End Source
For the life of me i can not seem to sort this out, if you cant figure out what its meant to do then here it is:
It finds a row according to the product id, then in that row are three image name place holder columns, the script should go thru those columns deciding weather or not to display a full image box or just an empty table cell.
Anyone, anyone at all, a solution would be much appreciated.
TIA
Mr Davidson
for($imageCount = 1; $imageCount <= 3; $imageCount ++){
You are missing a semi colon after $imageCount++. Should be:
for( $imageCount = 1; $imageCount <= 3; $imageCount++; ){
dc
for( $x=1; $x<=10; $x++;){
echo"\$x=".$x."\n";
}
Which resulted in this parse error:
Parse error: parse error, expecting `')'' in BLAH BLAH
I space out each parameter so as to determine where the problem lies and this is the result when using the following code setup:
for(
$x=1;
$x<=10;
$x++;
){
echo"\$x=".$x."\n";
}
The line in which the error lies seems to be with the last parameter, as u can see stating a missing ")" or "'" i cant quite tell nor decide let alone fathem it out. I've solved the issue with a work around altho if possible would like to resolve the problem with regards to the for statement.
Any help again would be apprecited
NOTE: I'm testing using apache/mysql on a win xp pro, not sure if this could be the root of the problem but every bit of info helps.
TIA
for($imageCount = 1; $imageCount <= 3; $imageCount++)
{
$imageResult=mysql_query("SELECT ....");
$imageField=mysql_fetch_array($imageResult){ //error is here
$imageRef="$imageField[prod_pic_".$imageCount."]";
if(($imageRef=="")OR($imageRef=="...gif")){
echo"<td> </td>";
} else {
echo"<td>...YOUR IMAGE CODE HERE...</td>";
}
}
}
Now, looking at error line closely:
$imageField=mysql_fetch_array($imageResult){ //error is here
You have an opening bracket( { ), which usually signals that there is some sort of loop or if/else. So, to fix the above, incorporate you loop(I think while() loop is what you want).
while( $imageField=mysql_fetch_array($imageResult) ){
That should take care of it.
Mr Davidson