I am really a newbie here, so pleae have patience with me.
I’ve got an index page where all my other pages will load. My pages are conected to the database and are getting different records. What i am trying to do, is to load the correct(to be similar with the pages loaded) metatags…title…description,into my index page.
Can you please give an ideea what to use, or how to do it?
I have recently coded a hidden session variable on http://johns-jokes.com that
displays the title, keywords and description for all the pages on my site.
Sorry for not explaining to good. I need to learn more english also.
ok, this is my database(one of the tables):
seo ( id int(255) NOT NULL AUTO_INCREMENT, actor_nume text COLLATE utf8_unicode_ci NOT NULL, album_nume text COLLATE utf8_unicode_ci NOT NULL, page_title text COLLATE utf8_unicode_ci NOT NULL, meta_keywords text COLLATE utf8_unicode_ci NOT NULL, meta_description text COLLATE utf8_unicode_ci NOT NULL, image varchar(1000) COLLATE utf8_unicode_ci NOT NULL, alt_tag text COLLATE utf8_unicode_ci NOT NULL, cloud_tags text COLLATE utf8_unicode_ci NOT NULL, album_description text COLLATE utf8_unicode_ci NOT NULL, actor_description text COLLATE utf8_unicode_ci NOT NULL, h1 text COLLATE utf8_unicode_ci NOT NULL, title text COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (id)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=3 ;
my index.php is under root folder
the pages which will load in index.php are under root/pagini/
when the pages from root/pagini/ will load in my index.php(under root), i want the information from seo table to be ‘echoed’ in my index.php, but to be the right data for each record.
the pages under root/pagini/ have sql queries also, getting different records from the database.
I am confused with your code but anyway maybe try this:
Include the following lines of code in index.php
<?php
session_start();
error_reporting(E_ALL);
ini_set('display_errors', 'On');
function check_session($msg='Display session elements')
{
echo $msg;
echo '<pre>';
print_r($_SESSION);
echo '</pre>';
}
// test to see the session elements
check_session('First test');
Also use the above function before and after loading your session variable from the database.
I tried one of the links you gave, highlighted the page and the following errors were displayed:
First test
Array
(
)
Notice: Undefined index: id in /home/mari/public_html/index1.php on line 18
Notice: Undefined index: actor_nume in /home/mari/public_html/index1.php on line 19
Notice: Undefined index: album_nume in /home/mari/public_html/index1.php on line 20
Notice: Undefined index: meta_keywords in /home/mari/public_html/index1.php on line 21
Notice: Undefined index: page_title in /home/mari/public_html/index1.php on line 22
Notice: Undefined index: meta_description in /home/mari/public_html/index1.php on line 23
Notice: Undefined index: image in /home/mari/public_html/index1.php on line 24
Notice: Undefined index: alt_tag in /home/mari/public_html/index1.php on line 25
Notice: Undefined index: cloud_tags in /home/mari/public_html/index1.php on line 26
Notice: Undefined index: album_description in /home/mari/public_html/index1.php on line 27
Notice: Undefined index: actor_description in /home/mari/public_html/index1.php on line 28
Notice: Undefined index: h1 in /home/mari/public_html/index1.php on line 29
Notice: Undefined index: title in /home/mari/public_html/index1.php on line 30
These errors need to be fixed.
I am off to bed and hopefully another poster can provide a solution.