I have a resource variable in php and I pass It to other php page using Smarty assignments but when I retrieve this resource variable on other php pages it becomes string type Variable. How can I convert it back to Resource variable ?
Its Like This:
$conn = mysql_connect($dbconfig['db_hostname'],$dbconfig['db_username'],$dbconfig['db_password']);
$smarty->assign("DBCONNNAME", $conn);
You’re clearly doing something wrong here. Smarty is a templating engine. If you need to use the database connection is Smarty, you would be breaking the whole concept of separating the logic of the application and the template/view.
Instead of passing the database connection resource to a Smarty template, do everything you need to do (e.g. fetching rows from the database tables) in the PHP script and then assign the data that you retrieve from the database to the Smarty template and display it.