I am trying to use the script below to create a link to each user home directory on the webserver. The url will be an ip address follow by the user complete name (ex: from the mysql db. I am having problem outputting the name as a url link. How should I format the printf command to get the username as a url link? Or is there another way of doing this? Could some please help.
Thank you.
<html>
<body>
<?php
$db = mysql_connect("localhost", "root"
mysql_select_db("testdb",$db);
$result = mysql_query("SELECT * FROM employees",$db);
if ($myrow = mysql_fetch_array($result)) {
echo "<table border=1>\n";
echo "<tr><td>Name</td><td>Position</td></tr>\n";
do {
printf("<tr><td>%s %s</td><td>%s</tr>\n", $myrow["first"], $myrow["last"], $myrow["address"]);
} while ($myrow = mysql_fetch_array($result));
echo "</table>\n";
} else {
echo "Sorry, no records were found!";
}
?>
</body>
</html>
Thank you.
<html>
<body>
<?php
$db = mysql_connect("localhost", "root"
mysql_select_db("testdb",$db);
$result = mysql_query("SELECT * FROM employees",$db);
if ($myrow = mysql_fetch_array($result)) {
echo "<table border=1>\n";
echo "<tr><td>Name</td><td>Position</td></tr>\n";
do {
printf("<tr><td>%s %s</td><td>%s</tr>\n", $myrow["first"], $myrow["last"], $myrow["address"]);
} while ($myrow = mysql_fetch_array($result));
echo "</table>\n";
} else {
echo "Sorry, no records were found!";
}
?>
</body>
</html>