Codice PHP:
<?php

class db_mysql {

    function 
variabili() {  //variabili per connessione db
    
    
$this->host "localhost" ;
    
$this->user "root" ;
    
$this->pw "" ;
    
$this->nomedb "ProvaFunzioni" ;
    
    
$this->connetti mysql_connect($this->host,$this->user,$this->pw) or die (mysql_error());
    
$this->connettidb mysql_select_db($this->nomedb,$this->connetti) or die (mysql_error());
    }

    function 
query($query) { //eseguo query
    
    
$this->variabili() ;  //richiamo variabili per connessione
        
if($this->connetti){
            
$this->sql mysql_query($query,$this->connetti) ;
            while(
$this->res mysql_fetch_array($this->sql)){
            echo 
"<tr><td>"$this->res['Nome']."</td></tr>" ;
            }
        }    
    }
}
$query "select * from prova" ;

$ogg = new db_mysql() ;
$res $ogg->query($query) ;
?>
    
    
<html>
<head>
<title>Documento senza titolo</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<table width="50%" border="1">
  <? echo $res ?>
</table>
</body>
</html>
metodo pezzottissimo come fa giustamente osservare spoon25..