uhh.. what you have won't even print anything, you have to have text in between your <a> and </a> tags for it to even show up on the page.

as for the errors, are you connected to a mysql server and did you select the database..? other than that, I have no idea what's wrong with your stuff. the code is fine, so it has to do with your query.

I just went and made a test table and tried using similar code, which resulted in the same error you were getting.. however, this error was because the table I had was named "table," which is a reserved word, and I was using "SELECT DISTINCT * FROM table." If you use reserved words for field/table names, you should enclose them in (`)'s, so that MySQL will recognize them.

The code I used is as follows:
PHP Code:
<?
  mysql_pconnect(host, user, pass);
  mysql_select_db("testing");
  $request = "SELECT DISTINCT test FROM dss";
  $query = mysql_query($request);
  $num = mysql_num_rows($query);
  echo 'showing ' . $num . ' records<br />';
  $i = 0;
  while($data = mysql_fetch_array($query)){
    $i++;
    echo $i . '. ' . $data['test'] . '<br />';
  }
?>
My final test table was named "dss" with one field named "test" and had 7 entries. All of them were unique, except two, so when using this script it only displayed 5:
HTML Code:
showing 5 records
1. 234
2. sfsdfs
3. 452345
4. 2423
5. 1
Not sure how your database is set up, but it seems to me that you're either leaving something important out of the code, or you're using reserved words in your queries and not properly quoting them.