Skip to content Skip to sidebar Skip to footer

Only First Row From Sql Query Is Displaying

My trying to show product desc in pop up. Mean when i click on product link then one pop up will open and show product desc. but here something is wrong. every product link showing

Solution 1:

You don't have loop any in your template script, that is why you see just one record vizualized.

I don't know exactly how your code is organized outside of the snippet you have posted, but assuming your data rows are in $rows array variable, the code will look something like that:

<?foreach($rowsas$row) { ?><tr><td ><?phpecho$img; ?></td><td>Book Name:</td><td ><?phpecho$row['pname']; ?></td><tdclass="text1">MRP:</td><td><?phpecho$row['price'];?></td></tr><? } ?>

Solution 2:

Try to make IDs of each DIV as Unique.

Below is the sample code, try to use it as per your requirement

<scriptlanguage="JavaScript">functiondisplayPopup(id) 
{
   var theDetail = document.getElementById(id);
        theDetail.style.display="block";
}

functionclosePopup(id)
{

    var theDetail = document.getElementById(id);

    if (theDetail.style.display=="block") 
    {
        theDetail.style.display="none";
    }
}
</script><?phpfor($i=0;$i<4;$i++){?><div><ahref="javascript:displayPopup('flyBox_<?phpecho$i;?>')"title="View larger image"class="ui-icon ui-icon-zoomin">View larger</a><divid="flyBox_<?phpecho$i;?>"style="display:none;"><divid="closeButton"><ahref="javascript:closePopup('flyBox_<?phpecho$i;?>')"><imgsrc="http://i1122.photobucket.com/albums/l523/Long_Islander/flyBoxClose.png"width="28"height="28"alt="Close Button"border="0" /></a></div><tablewidth="100%"height="100%"border="0"cellspacing="0"cellpadding="0"><tr><tdalign="center"><?phpecho"Div ".$i. " Content comes here";?></td></tr></table></div></div><?php }?>

Post a Comment for "Only First Row From Sql Query Is Displaying"