HomePHP Page 3 - Building a Quick and Easy Tag Board
Our Tag Board Script - PHP
Tag boards enable users to leave a short message on your site without having to go through the trouble of registering. From a development point of view, they are actually rather simple to develop. In this article we will create a quick and easy tag board for any web site. We will be taking advantage of the php and MySQL technologies.
Our tag board is made up of three functions, four defined constants, a switch statement and a nifty little comparison operator to help with those of you using error-reporting E_ALL.
So let's have a look at the complete version of our script, and then we will go through and look at the script with greater detail. Our Tag Board Script can be found below:
function doTags() { $conx = mysql_connect(HOST, USER, PASS) or die("Unable to connect to MySQL Server"); mysql_select_db(DB) or die("Unable to select Database");
$stSql = "SELECT tag_name, tag_url, tag_entry, tag_date FROM tagboard ORDER BY tag_date DESC"; $arrResult = @mysql_query($stSql); if (!$arrResult) { echo "Query Failed - Unable to Retrieve tags - ".mysql_error()." – Action Aborted"; exit(); }
function doInsert($__name, $__entry, $__url) { $conx = mysql_connect(HOST, USER, PASS) or die("Unable to connect to MySQL Server"); mysql_select_db(DB) or die("Unable to select Database");