mi da errore Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/raptxt/public_html/commenti.php on line 26 (la riga del while)

e mi mostra solo l'ultimo elemento della tabella del db e non tutti...

Codice PHP:
<?php session_start();

// Get the default templates, Includes and Database connections
include("header.php");

$tpl->assignInclude("content""themes/$themes/tpl/commenti.tpl");

// Prepare the template
$tpl->prepare();

// Get the menu items and links
include("menu.php");

// Assign needed values
$tpl->assignGlobal("theme"$themes);
$tpl->assignGlobal("imgfolder""http://raptesti.interfree.it");
$tpl->assign("version"$version);
$tpl->assign("type"$_GET['art']);
$a=1;

// The MySQL command to run
$select "SELECT * FROM commenti WHERE alb=$alb ORDER BY data, uid ASC";

// Run the query
$data mysql_db_query($sql['data'], $select) or die("commenti Failed!");
while (
$row mysql_fetch_array($data))
   {
      
// Get all the fields
      
$uid $row['uid'];
      
$nome $row['nome'];
      
$data $row['data'];
      
$commento $row['commento'];
      echo
"$nome $commento";
      
$nome=stripslashes($nome);
      
$commento=stripslashes($commento);
      
$commento=nl2br($commento);
      
$rap="";
      
if (
$nome =="" || $commento=""){
$nome="RapTxt"$commento="nessun commento inserito. Inserisci tu il primo!";}


      
// Set the values to template variables
      
$tpl->newBlock("commenti");
      
$tpl->assign("uid"$uid);
      
$tpl->assign("nome"$nome);
      
$tpl->assign("commento"$commento);
      
$tpl->assign("data"$data);
      
$tpl->assign("num"$a);
      
$a++;
    }

// Print the result
$tpl->printToScreen();

?>