Jump to content

pull a variable from an output to a function?


totallytech

Recommended Posts

Hey Guys,

I'm building a site to view images on, basically the image detail is stored in a database, the site is then accessed and a standard select query is used. I then get the image name etc pulled from the database. Is there a way to save that image name into a variable and get it to display on a form that is run from a function - completely independent to my viewing code...

 

Some sort of global variable, but that could change each time I viewed a different photo - and wouldn't have any effect on anyone else browsing the site etc - so the correct image name would always be passed?

Link to comment
Share on other sites

The answer is yes, but whether you should actually do that depends on what you're trying to describe.

 

You say "viewing code", which leads me to believe you are talking about using this global variable thing in multiple places in code that all run during the same page request. That last part is what matters most.

 

Maybe it'll be easier to understand your intentions if you post your code? Everything between the "viewing code" and the place where you would want to use this variable.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.