$conn = mysql_connect($host,$user,$pass); if (!$conn) { die('Could not connect: ' . mysql_error()); } //Connection has succeeded! if(mysql_select_db('bj_poetryforms',$conn)) { if(strlen($searchstring) == 1) { //Search for terms beginning with echo '
'; echo '

Search Results For Terms Beginning With - '; echo strtoupper($searchstring); echo '

'; //retrieve info $SQL = "SELECT name, description FROM glossary "; $SQL = $SQL . "WHERE name LIKE '"; $SQL = $SQL . $searchstring . "%' ORDER BY name"; $retid = mysql_query("SET NAMES utf8"); //makes sure result renders correctly $retid = mysql_db_query('bj_poetryforms',$SQL, $conn); if (!$retid) { die( mysql_error()); } else { /* fetch rows */ $NumberOfRows = mysql_num_rows($retid); for ($i = 0; $i < $NumberOfRows; $i++) { if (!mysql_data_seek($retid, $i)) { echo "Cannot seek to row $i: " . mysql_error() . "\n"; continue; } if (!($row = mysql_fetch_assoc($retid))) { continue; } echo '

'; echo ucfirst($row['name']); echo '


'; echo parse_bbcode($row['description']); } echo '
'; echo '

Search Glossary by Alphabetical Order

'; echo 'a-b-c-d-e-f-g-h-i-j-k-l-m-n-o-p-q-r-s-t-u-v-w-x-y-z'; echo '
'; echo ''; echo '

 

'; echo '
'; echo '

Bookmark this page


'; echo '
'; echo ''; echo '
Social Bookmarks'; echo '
'; } echo '
'; } else { //Connection is totally successful //retrieve info $SQL = " SELECT * FROM glossary "; $SQL = $SQL . " WHERE name = '$searchstring' "; $retid = mysql_query("SET NAMES utf8"); //makes sure result renders correctly $retid = mysql_db_query('bj_poetryforms',$SQL, $conn); if (!$retid) { die( mysql_error()); } //If we are here we have succeeded in finding our info if($result = mysql_fetch_assoc($retid)) { echo '
'; echo '

Search result for '; echo ucfirst($searchstring); echo '

'; echo '
'; echo '

Description

'; #brief info here, prase for links echo parse_bbcode($result["description"]); echo '

'; echo '

'; echo '
'; echo '

Search Glossary by Alphabetical Order

'; echo 'a-b-c-d-e-f-g-h-i-j-k-l-m-n-o-p-q-r-s-t-u-v-w-x-y-z'; echo '
'; echo ''; echo '

 

'; echo '
'; echo '

Bookmark this page


'; echo '
'; echo ''; echo '
Social Bookmarks'; echo '
'; echo ''; } else { $to = "ben@bensonofjohn.co.uk"; $subject = "Missing glossary search term"; $body = "The following term was looked up in the Poetic Glossary, but no entry was found ".$searchstring; //mail($to, $subject, $body); echo '

All Apologies


Sorry your search did not yield any results. The site maintainer has been alerted and will look into this issue ASAP. In the meantime, please press the back button on your Browser and try a different search term.'; } } } mysql_close($conn); ?>
Home - Poetry - Programming