Dynamic ALT tags

Alexej Kubarev

New member
<?
$sql="SELECT alt_tag FROM my_table WHERE id=1";
$result=mysql_query($sql) or die("Oooups: ".mysql_error());
$row=mysql_fetch_assoc($result);
echo("<image src='images/my_image.jpg' alt='".$row['alt_tag']."'>");
?>

That code should work... you might want to save alt_tag with addslashes() to the database and use instead of $row['alt_tag'] this:
stripslashes($row['alt_tag'])

The code works for my juuuust fine :D
so i hope it will work for you too..
 
Back
Top