big-dog1965 Posted May 26, 2009 Share Posted May 26, 2009 How do I mod this to make the website and email address links on the page $query= 'SELECT Venue_Logo, Venue_Name, Venue_Show_Time, Venue_Show_Time, Host, Host_Email, Venue_Address, Venue_City, Venue_Email, Venue_Phone, Venue_Website FROM VenueUploads ORDER BY Venue_Show_Time ASC LIMIT 0, 100'; $result = mysql_query($query) or die(mysql_error()); while($row = mysql_fetch_array($result)) { if(empty($row['Venue_Logo']) || !file_exists("admin/venue/logos/{$row['Venue_Logoe']}")) { echo "<img src='admin/venue/logos/noimage.gif'>"; // no image }else{ echo "<img src=' admin/venue/logos/{$row['Venue_Logo']}'>"; // found image } if (!empty($row['Venue_Name'])) echo $row['Venue_Name']."<br />\n"; if (!empty($row['Venue_Show_Time'])) echo "Date: ".$row['Venue_Show_Time']."<br />\n"; if (!empty($row['Host'])) echo "Host: ".$row['Host']." "; if (!empty($row['Host_Email'])) echo "Host Email: ".$row['Host_Email']."<br />\n"; if (!empty($row['Venue_Address'])) echo "Address: ".$row['Venue_Address']."<br />\n"; if (!empty($row['Venue_City'])) echo "City: ".$row['Venue_City']."<br />\n"; if (!empty($row['Venue_Email'])) echo "Email: ".$row['Venue_Email']."<br />\n"; if (!empty($row['Venue_Phone'])) echo "Phone: ".$row['Venue_Phone']."<br />\n"; if (!empty($row['Venue_Website'])) echo "Website: ".$row['Venue_Website']."<br />\n"; echo "<hr>"; } Right now it displays the website and the email address but they are not links just text. Link to comment https://forums.phpfreaks.com/topic/159712-solved-creating-clickable-links-from-mysql-display-page/ Share on other sites More sharing options...
Brian W Posted May 26, 2009 Share Posted May 26, 2009 Assuming that the URLs have http:// already in them, this will work. $query= 'SELECT Venue_Logo, Venue_Name, Venue_Show_Time, Venue_Show_Time, Host, Host_Email, Venue_Address, Venue_City, Venue_Email, Venue_Phone, Venue_Website FROM VenueUploads ORDER BY Venue_Show_Time ASC LIMIT 0, 100'; $result = mysql_query($query) or die(mysql_error()); while($row = mysql_fetch_array($result)) { if(empty($row['Venue_Logo']) || !file_exists("admin/venue/logos/{$row['Venue_Logoe']}")) { echo "<img src='admin/venue/logos/noimage.gif'>"; // no image }else{ echo "<img src=' admin/venue/logos/{$row['Venue_Logo']}'>"; // found image } if (!empty($row['Venue_Name'])) echo $row['Venue_Name']."<br />\n"; if (!empty($row['Venue_Show_Time'])) echo "Date: ".$row['Venue_Show_Time']."<br />\n"; if (!empty($row['Host'])) echo "Host: ".$row['Host']." "; if (!empty($row['Host_Email'])) echo "Host Email: <a href=\"mailto:".$row['Host_Email']."\">".$row['Host_Email']."</a> <br />\n"; if (!empty($row['Venue_Address'])) echo "Address: ".$row['Venue_Address']."<br />\n"; if (!empty($row['Venue_City'])) echo "City: ".$row['Venue_City']."<br />\n"; if (!empty($row['Venue_Email'])) echo "Email: ".$row['Venue_Email']."<br />\n"; if (!empty($row['Venue_Phone'])) echo "Phone: ".$row['Venue_Phone']."<br />\n"; if (!empty($row['Venue_Website'])) echo "Website: <a href=\"".$row['Venue_Website']."\" target=\"_blank\">".$row['Venue_Website']."</a> <br />\n"; echo "<hr>"; } Link to comment https://forums.phpfreaks.com/topic/159712-solved-creating-clickable-links-from-mysql-display-page/#findComment-842490 Share on other sites More sharing options...
big-dog1965 Posted May 26, 2009 Author Share Posted May 26, 2009 Thanks I got this if (!empty($row['Host_Email'])) echo "Host Email: <a href='mailto:".$row['Host_Email']."'>".$row['Host_Email']."</a><br />\n"; if (!empty($row['Venue_Website'])) echo "<a href='".( strpos( '://', $row['Venue_Website'] ) ? '' : 'http://' ).$row['Venue_Website']."'>".$row['Venue_Website']."</a><br />\n"; But as always this site rocks for answer Link to comment https://forums.phpfreaks.com/topic/159712-solved-creating-clickable-links-from-mysql-display-page/#findComment-842556 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.