I have some info in a MySQL database. One of the columns is called "tags" and I want to put its contents in a meta keyword tag in the header. I am displaying other info from the database, but I can't get it to display in the header. Each page looks roughly like this... include header.php Page content include footer.php My SQL query looks something like 'SELECT * FROM tablename WHERE id='.$id Content is then being placed into the page. The issue is that I can't get the tags to display in the header (which is a different file) I hope you can understand this. Thanks for the help.
is there an error message? add some 'or die()' statements to your code. ans also please see this site: parseerror.com/~pizza/select*isevil.html
I do not have an 'or die()' statement on there, I'll try that later today when I get a minute. Thanks
I did some tests to try to fix the problem. I don't think my issue is with the MySQL database. If I have an index.php file with this coding... <? $title="Index.php title"; ?> <? include 'http://mysite.com/header.php'; ?> index.php contents </body> </html> Code (markup): and my header looks like... <html> <head> <title><? print $title; ?></title> </head <body> Code (markup): Nothing is displayed in the title. I have done this on other sites, and I can't figure out why it won't now.
When you specify a URL as the include path the PHP code is processed on the server where you are pointing to, in it's own variable scope. Its as if you typed http://mysite.com/header.php into your browser, the header.php is executed on it's own. If, for some strange reason, you must use a remote URL like that you can pass variables to it like regular GET parameters: <? include 'http://mysite.com/header.php?title=helloworld'; ?> Then in the header.php you would have to grab it from $_GET['title'] I hope that helps
It did help. The reason it worked for me in the past was that I normally used <? include ($_SERVER['DOCUMENT_ROOT'].'/header.php'; ?> Once I switched it, it worked perfect. Thanks for the help.