View Full Version : Problem with hyperlinks.

Mr Mojorisin
05-30-2005, 08:07 PM
I have made a Mysql database with the columns; “ID”, “Name” and “URL”. I want to use this to create a php site with links (portal).
In Dreamweaver MX2004 I have made a recordset with “ID”, “Name” and “URL”.
My goal is to have the “Name” on the site visible as a hyperlink, and if it is clicked on a new page with the “URL” that belongs to the “Name” has to open.
I have managed to get the “Name” on the site, as well as the “URL” but if I click on it nothing happens.
There’s no problem with Mysql or the recordset I have made. All records appear on the screen if I want to. I would like to know what I have to do in Dreamweaver MX2004 to make a hyperlink out of two entries from the database (“Name” and “URL”).
PS. Excuse me for my poor English!

06-20-2005, 06:45 AM

/////////////////////////////// SETTINGS ///////////////////////////////
$db_host = ""; // MySQL Host (most likely 'localhost')
$db_user = ""; // MySQL Username
$db_pass = ""; // MySQL Password
$db_name = ""; // MySQL DB Name

$tbl_name = ""; // MySQL Table Name

$result_sortBy = ""; // 'ID', 'Name' or 'URL' (Column Name)
$result_sort = ""; // 'ASC' or 'DESC' (Acending or Descending)
/////////////////////////////// SETTINGS ///////////////////////////////

$link = mysql_conenct( $db_host, $db_user, $db_pass );
mysql_select_db( $db_name, $link );

$query = "SELECT * FROM $tbl_name SORT BY $result_sortBy $result_sort";
$result = mysql_query( $query );

while( $row = mysql_fetch_array( $result ) )
echo( "<a href='".$row['URL']."' alt='".$row['URL']."' target='_blank'>".$row['Name']."</a><br />" );

mysql_close( $link );

That should work just fine.
Any questions just feel free to contact me... just make sure I know what it is about.

Good Luck,
Tom Milewski

07-15-2005, 04:38 PM
Dear Tom,

Please, can i do that with asp and an access dbase?