I have a MySQL table made up of several fields, 2 of which are for the url, one field is labelled ‘prefix’ which contains ‘http://’ and the other field contains the remaining section of the url i.e. www.midchesh.ac.uk or ‘shop.niace.org.uk/adultslearning-free-sample.html’.
I have echoed the info out onto the screen but now want to connect the ‘prefix’ and ‘url’ fields from the database to enable the user to click on the link and go to the destination.
Unfortunately at the moment when I click a link it keeps the current url in the address bar and just tags the new url to the end which obviously causes an error.
The script below is the php I currently have, I would be grateful if someone could advise as to where I have made the error.
Thanks
$query = “SELECT * FROM resources”;
$result = mysql_query($query) or die(mysql_error());
echo ‘
Websites and Journals
’;while ($row = mysql_fetch_array($result))
{
echo $row['id'] . '<br />';
echo $row['type'] . '<br />';
echo "<a href=/" . $row['prefix'] . $row['url'] . ">" . $row['prefix'] . $row['url'] . "</a>";
echo '<br />' . $row['notes']. '<br /><br /><hr /><br />';
echo "<br />";
}
Thanks again for any help.