I am trying to add a mouseover hover which basically works on the first MySQL returned query. However it will not work. It does not recognise my IF ELSE statement and it just returns the ELSE command.
My data is like
gallery
----------------------
id sku img types
1 454_red front.jpg F
2 454_red back.jpg F
3 452_red front.jpg F
4 452_red back.jpg F
5 452_red a1.jpg S
6 452_red a2.jpg S
My PHP
<?
$imgsql=mysql_query("SELECT * FROM `gallery` WHERE `gallery`.`sku` = '".$r['sku']."' ORDER BY `gallery`.`type` ASC");
while($rimg=mysql_fetch_array($imgsql)){
?>
<? if($rimg == $rimg['0']){ ?>
<div>
<a href="product.php?prodref=<?=$r['sku']?>"><img src="//super.cdn.com/<?=$r['sku']?>/<?=$rimg['img']?>.jpg" onmouseover="this.src='//super.cdn.com/<?=$r['sku']?>/back.jpg'" onmouseout="this.src='//super.cdn.com/<?=$r['sku']?>/<?=$rimg['img']?>.jpg'"/></a>
</div>
<? } else { ?>
<div>
<a href="product.php?prodref=<?=$r['sku']?>"><img src="//super.cdn.com/<?=$r['sku']?>/<?=$rimg['img']?>.jpg"/></a>
</div>
<? } ?>
<? } ?>
The $r["sku"] is called at the top of the code, this sits inside a product listing loop.
$row['0']...? Where'd this come from...? And what does "does not work" mean exactly?if($rimg == $rimg['0'])...? How does this condition make any sense?