Hi, I have a bit of a strange problem where I am unable to "echo" results from a database -
I will show you the code then explaine what im trying to do
<?php
include_once "connect_to_mysql.php";
$sql = mysql_query("SELECT * FROM table ORDER BY RAND(), LIMIT 1");
while($row = mysql_fetch_array($sql)){
$add = $row["add"];
$link = $row["link"];
$title = $row["title"];
echo "
<b>$add</b>
<a href='$add'$link</a>
";
}
?>
db has the following fields id, add, link, title
The script to connect to the database works fine, as if i change the host, it gives me an error.
But im not getting any images from the database
What im trying to do is, randomly select any field and link the add field using the link field, so if a user clicks the add shown, it will take them to the website address in the link field.
Im also not sure how to add the title, so when a user hovers over the add shown, it will show a title tag ???
Can someone provide any helpful guidance to help me learn more coding skills.
Thanks to those who reply,
Lloyd