PHP: Read a variable at top present at bottom -


Is there a way to read a variable at the top, where some place is defined below. Here is an example of such a situation:

   // This code is somewhere near the bottom of the page $ logo_query = "Select Logo_path from table where id = $ line-> user_id"; $ Res_logo = mysql_query ($ logo_query) or die (mysql_error ()); $ Row_logo = mysql_fetch_object ($ res_logo); $ Logo_path = $ row_logo- & gt; Logo_path; Function logpot () {global $ logo_path; Return $ logo_path;  

I tried to return the value to use that function, but it also does not seem to work.

Any solution?

Thank you $ logo_path at the top of the place where you call the logopath () function.

Alternatively, you can put the SQL code in the logo () function, which will allow you to provide functions that give the path of the logo under the place where you call the function.


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

jquery - SimpleModal Confirm fails to submit form -

php - Multiple Select with Explode: only returns the word "Array" -