List Peters wrote: > > <html> > <body> > navigation > <?php include file depending on url?> > <body> > </html> > > In the include file I have all the code i need. > > My problem is that for one page in the site I need to display a image in the > navigation bar that is referenced from a database. The database query > happens in the included file which is below the navigation in the html - > This means i cant reference the image file name because the query hasnt > happened.
Well, either write the sql code twice, or could break out all your database queries into functions which you then put in a php file (say db_funs.php). Now require("db_functions.php") at the top of your file and call the get_navbar_image () when you need it. You also need to require("db_functions.php") in the "include file depending on url" file. The general philisophy is thus to put all programming logic which you use more than once in separate functions which you include. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php