php - Display image with URL from MySQL -



php - Display image with URL from MySQL -

i using code display image url, not working,

<?php echo 'me'.'<br/>'; $sql= 'select url_imgsrch p_url_imgsrch'; $result = mysql_query($sql); echo $result; $row = mysql_fetch_row($result); ($i=0; $i<6; $i++){ //calling rows echo '<td>';

//calling rows value debugging purpose can larn process , check output

echo $row[$i].'<br/>'; echo '<img name="myimage" src="<?php echo $row[$i]; ?>" width="60" height="60" alt="word" />'; echo '</td>'; } ?>

the result is, alt text only, , image not displayed. also, error

notice: undefined offset: 1 in d:\wamp\www\demo\login\flashcard.php on line 31

in file trying is, 5 img url database , display them in columns of table..and guess getting same img url 1 time again , again...for 5 times..

please give me guideline , tell me missing...

i have never seen loop through query way, this:

print "<table>"; $sql= 'select url_imgsrch p_url_imgsrch limit 5'; $result = mysql_query($sql); while($row = mysql_fetch_array($result)){ print '<tr> <td> <img name="myimage" src="'.$row[column_name_here].'" width="60" height="60" alt="word" /> </td> </tr>'; } print "</table>";

change column_name_here name of column store image file name

edit: changed mysql_fetch_row mysql_fetch_array <- why u got same image 5 times.

php mysql html url image

Comments

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -