Note that there are some explanatory texts on larger screens.

plurals
  1. POdynamically get image and description php
    primarykey
    data
    text
    <p>I want to display image and its description(on hover) dynamically in localhost</p> <pre><code>$c=mysql_connect("localhost","abc","xyz"); mysql_select_db("root"); q="select * from product"; $qc=mysql_query($q); while($ans=mysql_fetch_array($qc)) { print "&lt;img id='display_img' src='products/$ans[8]'width=300 height=200&gt;"; print $ans[9] ; } </code></pre> <p>but this shatters every think. I want to display image description on top of image.</p> <p>i tried this</p> <pre><code> &lt;?php $c=mysql_connect("localhost","abc","xyz"); mysql_select_db("root"); $q="select * from product"; $qc=mysql_query($q); $count=0; while($ans=mysql_fetch_array($qc)) { if($count==0||$count==1||$count==2) { $title=$ans[1]." ".$ans[2]; print '&lt;div class="img-wrap"&gt;'; print "&lt;img id='display_img' src='products/$ans[8]'width=300 height=200 title='$title'&gt;"; print '&lt;div class="img-overlay"&gt;'; print '&lt;h4&gt;'.$title.'&lt;/h4&gt;'; print '&lt;p&gt;'.$ans[9].'&lt;/p&gt;'; print '&lt;/div&gt;'; print '&lt;/div&gt;'; } $count++; if($count==3) { print "&lt;br /&gt;"; $count=0; } } ?&gt; css code .img-wrap { height:200px; position:relative; width:300px; margin:10px; } .img-overlay { background-color:#000; bottom:0; color:#fff; height:200px; width:300px; opacity:0; position:absolute; z-index:1000; transition-duration:0.5s; cursor:pointer; } .img-overlay h4, .img-overlay p{ padding:0 10px; } .img-wrap:hover .img-overlay{ opacity:0.75; transition:opacity 0.5s; } b { background-color:#aa490e; color:#fff; font-size:36px; padding: 0 15px; padding-left:65px; padding-bottom:25px; font-family:"Courier New", Courier, monospace; } </code></pre> <p>it gives me vertical output:</p> <p><a href="http://img707.imageshack.us/img707/4149/kn0b.png" rel="nofollow">http://img707.imageshack.us/img707/4149/kn0b.png</a></p> <p>but i want output like :</p> <p><a href="http://img441.imageshack.us/img441/8114/it5a.png" rel="nofollow">http://img441.imageshack.us/img441/8114/it5a.png</a></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload