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
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
Post a Comment