-
retrieving and displaying url and email from mysql using php
I am obviously making an error. The following code achieves the result of displayingall data, plus a http and email link from the mysql database. But both come up with "" around the links. What have I done wrong ? I am trying to keep it simple, the idea is to get all clubs etc from the dbase with links for websites and email.
$dbh = mysql_connect($hostname, $username, $password)
or die("Unable to connect to MySQL");
print "Connected to MySQL<br>";
$selected = mysql_select_db("sc010_athleticsdb",$dbh)
or die("Could not select first_test");
$result = mysql_query("SELECT * FROM clubs");
print ("<TABLE BORDER=1 WIDTH=\"75%\" CELLSPACING=2 CELLPADDING=2 ALIGN=CENTER>\n");
print ("<TR ALIGN=CENTER VALIGN=TOP>\n");
print ("<TD ALIGN=CENTER VALIGN=TOP>CLUB NAME</TD>\n");
print ("<TD ALIGN=CENTER VALIGN=TOP>TOWN</TD>\n");
print ("<TD ALIGN=CENTER VALIGN=TOP>COUNTY</TD>\n");
print ("<TD ALIGN=CENTER VALIGN=TOP>COUNTRY</TD>\n");
print ("<TD ALIGN=CENTER VALIGN=TOP>WEBSITE</TD>\n");
print ("<TD ALIGN=CENTER VALIGN=TOP>EMAIL</TD>\n");
print ("</TR>\n");
while ($row = mysql_fetch_array($result,MYSQL_ASSOC)) {
print ("<TR ALIGN=CENTER VALIGN=TOP>\n");
print ("<TD ALIGN=CENTER VALIGN=TOP>$row[club_name] </TD>\n");
print ("<TD ALIGN=CENTER VALIGN=TOP>$row[club_town] </TD>\n");
print ("<TD ALIGN=CENTER VALIGN=TOP>$row[club_county] </TD>\n");
print ("<TD ALIGN=CENTER VALIGN=TOP>$row[club_country] </TD>\n");
print ("<TD ALIGN=CENTER VALIGN=TOP><a href=http://\"$row[club_website]\">$row[club_website]<a/> </TD>\n");
print ("<TD ALIGN=CENTER VALIGN=TOP><a href=mailto:\"$row[club_email]\">$row[club_email]<a/> </TD>\n");
print ("</TR>\n");
}
mysql_close($dbh);
?>
Any help appreciated.
Laugharne
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|