If it makes any difference, I haven't got any html tags set up. Full code follows:
<?
$dbh=mysql_connect ("localhost", "alwaysac", "xxx") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("alwaysac_MyArticles");
// Perform Query
$result = mysql_query("SELECT * FROM Articles WHERE upper(left(TopicName,1))='".$filter."' ORDER BY TopicName");
// Check result
// This shows the actual query sent to MySQL, and the error. Useful for debugging.
if (!$result) {
$message = 'Invalid query: ' . mysql_error() . "\n";
$message .= 'Whole query: ' . $query;
die($message);
}
// Use result
// Attempting to print $result won't allow access to information in the resource
// One of the mysql result functions must be used
// See also mysql_result(), mysql_fetch_array(), mysql_fetch_row(), etc.
while ($row = mysql_fetch_assoc($result)) {
echo "<a href='http://www.mysite.com'>test</a>";
$row['TopicName']
echo $row['MetaTitle'];
echo "<br>";
}
// Free the resources associated with the result set
// This is done automatically at the end of the script
mysql_free_result($result);
?>