Hello people,
I'm a NewB 2 PHP. Can anyone help me with this:
I have created a simple DB table using PostgreSQL with values in the table.
My PHP code to retrieve data is:
<?PHP
echo "<br><left><small>CONNECTION MESSAGES <br>";
echo "<ul>";
echo "<li>establishing connection with database</li>";
$conn = pg_Connect ("port=5432 dbname=abu user=ma401ak");
if (!$conn) {
echo "<li>connection to database failed</li>"
; exit; }
$result = pg_exec ($conn, "SELECT DISTINCT name
FROM staff
ORDER BY name");
if (!$result) {
echo "<li>an error has occured in getting data from
database</li>";
exit;}
echo "<li>connection to database ok</li>" ;
echo "<br></left></small></ul><hr>";
echo "<b>LIST OF STAFF<br><ol>";
for ($row = 0; $row < pg_numrows($result); $row++) {
$tuple = pg_fetch_array($result, $row);
echo "<li>" . $tuple["name"] . "</li>";
}
pg_Close($conn);
echo "</ul></b><hr>";
?>
Output looks like this:
CONNECTION MESSAGES
. establishing connection with database
. connection to database ok
LIST OF STAFF
- Dr What Ever
- Dr Joe Blogs
Here what I can't do:
I want each staff to have an actual website link next to there name. So lets say:
- Dr What Ever Vist My Home Page
Visit My home page should be a website link... Also is it possible have a BUTTON i.e: 'Visit My Home Page' as a button rather than just a link.
Both the button & Link solution will be most appreciated.
Thanks a Million
P/S: The websites are stored in a column/tuple named 'url' in this format:
www.whatever.com