Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8588039
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T22:43:04+00:00 2026-06-11T22:43:04+00:00

I have a resource variable in php and I pass It to other php

  • 0

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);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T22:43:05+00:00Added an answer on June 11, 2026 at 10:43 pm

    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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have discovered that it is possible to populate resource strings with variable information
I have couple resource DLLs that I currently load when application starts using following
I have a RESTful resource in my Rails app called Photo. I'm using Paperclip
I have a mySQL database from where I fetch some data via PHP. This
I'm making an MSN client in PHP. I have this code, which connects to
I have multiple calls to many RESTful services. I translate to PHP using native
I have a page which allows users to upload photos - fairly standard php
Is it possible to give a mysql resource to a $_SESSION variable ? //mysqldb.inc.php
Possible Duplicate: Pass a PHP string to a Javascript variable (and escape newlines) I
I have a large PHP loop that I'm re-using in multiple spots on multiple

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.