$output[] = '<td><IMG SRC="../cart-demo/images/1.jpg" WIDTH="100" HEIGHT="100"></td>';

hi,

i am facing a small problem. can any one hint me or help me with the image property i wanna increase the 1.jpg to 2.jpg and so on..

kindly help

With Regards
danny

Member Avatar for diafol

I assume this is in a loop of some description:

$i = 1;

...start loop...

         $output[] = "<td><img src=\"../cart-demo/images/$i.jpg\" width=\"100\" height=\"100\"></td>";
         

         $i = $i + 1;
...end loop...

Note the changes to the html within double quotes.
Use concatenation on variable ($i) if using single quotes.

i know it comes in a loop but i am unable to ad it in a loop ... !!

$output[] = '<td><IMG SRC="../cart-demo/images/'.$id.'.jpg" WIDTH="100" HEIGHT="100"></td>';

where $id is the id from mysql database... but this method gives me error.. :(

Member Avatar for diafol
$max_no = 25; //change this

$i = 1;
while($i < $max_no+1){
    $output[] = '<td><IMG SRC="../cart-demo/images/'.$id.'.jpg" WIDTH="100" HEIGHT="100"></td>';
    $i = $i + 1;
}

Thanx a lot ardav sir

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.