converting code into smarty
Dear Sir, please help me do this assignment.
Piece of code below contains database queries, PHP and HTM all in one. Convert the following piece of code into smarty.
//db configuration
include "config.php";
if(!($db = @mysql_connect($server, $db_user, $db_pass))) //connect to database
die("Couldn't connect to the database.");
if(!@mysql_select_db($db_name, $db)) //select database
die("Database doesn't exist!");
$sql = "SELECT * FROM users";
if(($result = @mysql_query($sql, $db)) == 0)
{
echo "nDatabase error: ".mysql_error()."
n";
die("MySQL Said: " . mysql_error());
}
$user = array();
?>
while($tmp = mysql_fetch_assoc($result))
{
?>
}
?>