Hi,
I have in my database the location of some images I want to display, all formatted as:
../images/products/1.jpg
../images/products/1.jpg
I'm trying to diplay them in a webpage but get the following error:
x
Warning: substr() expects parameter 1 to be string, array given in C:\xampp\htdocs\mysite\index.phpx
Warning: substr() expects parameter 1 to be string, array given in C:\xampp\htdocs\mysite\index.php
The 'x's display fine, matching the number of row in the database, but the images do not.
Here is my code:
<?php
$query = "SELECT product_Picture from products LIMIT 0, 10";
$result = mysql_query($query) or die(mysql_error());
$x=0;
while($row = mysql_fetch_array($result))
{
echo 'x';//these work
$row[x] = substr($row, 3);//removes the leading .. from the stored URLs
echo "<img src='".$row."' /><br />";
}
?>
Can anyone help me correct this problem?
Your help is most appreciated!
Thanks!