tags:

views:

40

answers:

3

I have this string:

$imagename ="$ad_id_stripped"."_1".".jpg";
$display_table.="<a href='../ad.php?ad_id=$row[ad_id]' target='_parent'>
<img style='border:none;' src='../ad_images/$category/thumbs/$imagename?time()' class='shadow'></a>";

echo $display_table;

As you maybe can see I am trying to add the time() function in there... However, there is no time() added to it like this! I have tried with various quotes etc without luck...

Any ideas?

Thanks

+3  A: 
$imagename ="$ad_id_stripped"."_1".".jpg";
$display_table.="<a href='../ad.php?ad_id=$row[ad_id]' target='_parent'>
<img style='border:none;' src='../ad_images/$category/thumbs/$imagename?" . time() . "' class='shadow'></a>";

echo $display_table;

You want to get the time() function out of the string itself and concatenate

Marek Karbarz
+3  A: 

You can't do:

$string = "....time()...";

You will need to do:

$string = "..." . time() . "....";

or

$time = time();
$string = "....$time...";
cletus
A: 

Strings wrapped in double quotes will parse variables, but not functions. Try this:

$imagename ="$ad_id_stripped"."_1".".jpg";
$time = time();
$display_table.="<a href='../ad.php?ad_id=$row[ad_id]' target='_parent'>
<img style='border:none;' src='../ad_images/$category/thumbs/$imagename?$time' class='shadow'></a>";

echo $display_table;
marcvangend