I am using this code to display image from URL, but it is not working,
<?php
echo 'me'.'<br/>';
$sql= 'SELECT url_imgsrch FROM p_url_imgsrch';
$result = mysql_query($sql);
echo $result;
$row = mysql_fetch_row($result);
for ($i=0; $i<6; $i++){
//calling rows
echo '<td>';
//calling rows value for debugging purpose so that i can learn the process and check the 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, I get alt text only, and image is not displayed. also, I get error
Notice: Undefined offset: 1 in D:\wamp\www\demo\login\flashcard.php on
line 31
In my file
What I am trying is, to get 5 img url from database and display them in columns of a table..and what I guess is I am getting same img URL again and again…for 5 times..
Please give me guideline and tell me what I could be missing…
i have never seen someone loop through a query that way, i do it like this:
change column_name_here to the name of the column which store the image file name
edit: changed
mysql_fetch_rowtomysql_fetch_array<- that is why u got the same image all 5 times.