Forum Moderators: coopster
"how to link a website address stored in a database onto an image in my computer"
I could not understd as to what you mean by that..but I guess you are trying to hyperlink a picture to a website address saved in db.if that's the case,this is how i will do it.
1.connect to db & get the column/row data using LIST command
2.save website address in a variable ..like $ADDRESS = "www.sitenameexample.com"; //this will be value from db from step 1
3.rest should be something like.. echo" <a href='$ADDRESS'> <img src = 'path to picture'> </a> ";
hope that helps
echo "<table>";
$sql="select link, logo from testlogo order by logo";
$array = array();
if(mysql_query($sql))
{
$check=mysql_query($sql);
while($row=mysql_fetch_row($check)){
$array[] = $row[0];
}
}
$cols = 3;
$count = count($array);
if($count%$cols > 0){
for($i=0;$i<($cols-$count%$cols);$i++){
$array[] = ' ';
}
}
echo "<table border=\"3\">\r\n";
foreach($array as $key => $link){
if($key%$cols == 0) echo "<tr>\r\n";
echo "<td><a href='$link'><img src='$logo' alt='test' /></a></td>\r\n";
if($key%$cols == ($cols - 1)) echo "</tr>\r\n";
}
echo "</table>";
?>
echo "<table>";
$sql="select link, logo from testlogo order by logo";
$array = array();
if(mysql_query($sql))
{
$check=mysql_query($sql);
while($row=mysql_fetch_row($check)){
$array[] = "<a href=\"$row[0]\"><img src=\"$row[1]\" alt=\"test\" /></a>";
}
}
$cols = 3;
$count = count($array);
if($count%$cols > 0){
for($i=0;$i<($cols-$count%$cols);$i++){
$array[] = ' ';
}
}
echo "<table border=\"3\">\r\n";
foreach($array as $key => $link){
if($key%$cols == 0) echo "<tr>\r\n";
echo "<td>$link</td>\r\n";
if($key%$cols == ($cols - 1)) echo "</tr>\r\n";
}
echo "</table>";
?>