Covert the following piece of code into smarty template.
Dear Sir, I can not understand the following questions.. For the 1st question, can i just assign the text "This is my first smarty example" to a variable say "name" and just insert {$name} in the template file?
For the 2nd question, can i create database? i am really get confuse how to solve these question.. Please help me and i want to submit this assignment within in 4 days...So pls pls help me....
1) Covert the following piece of code into smarty template.
echo "This is my first smarty example";
?>
2) 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 "n
Database error: ".mysql_error()."
n";
die("MySQL Said: " . mysql_error());
}
$user = array();
?>
while($tmp = mysql_fetch_assoc($result))
{
?>
}
?>