ljzxtww Posted July 17, 2008 Share Posted July 17, 2008 Hi: this is code for title header.php $sitename = The name of your website $siteurl = The URL to the affiliate script as it is installed on your site $redirecturl = The URL where visitors are redirected to after coming to your site using an affiliate link. $affpay = The amount affiliates are paid for each sale. If you set it to 5.00, then affiliates will get paid 5.00 for each sale. $aduser = Your management login username $adpass = Your management login password $dbhost = Your database host (usually localhost) $dbuser = Your database username $dbpassword = Your database password $dbname = The name of your database use mysql print on hearder.php code following <html> <head> <title><?=$sitename?></title> </head> <body> <h1><?=$sitename?></h1> how to create a phpmyadmin data on mysql and print this code on <title><?=$sitename?></title> and index.php call HP Freaks Forums thank you larry Quote Link to comment https://forums.phpfreaks.com/topic/115172-php-code-helpplease-help/ Share on other sites More sharing options...
trq Posted July 17, 2008 Share Posted July 17, 2008 What? Quote Link to comment https://forums.phpfreaks.com/topic/115172-php-code-helpplease-help/#findComment-592208 Share on other sites More sharing options...
apotterdd Posted July 17, 2008 Share Posted July 17, 2008 You shouldn't have to put the title of a page into your database. You can use a function and define it. function title() { echo "<title>Site Title</title>"; return; } then you just call it up on your pages using the following syntax: title(); Is that what you were asking for? Or are you just wanting the variable to show up? The way you've written it won't return anything <?=$sitename?> isn't proper and it won't show because of the = in that. I think it's best to have one file that calls you most comon functions and include that into the web pages that they need to be into. Quote Link to comment https://forums.phpfreaks.com/topic/115172-php-code-helpplease-help/#findComment-592270 Share on other sites More sharing options...
unkwntech Posted July 17, 2008 Share Posted July 17, 2008 <html> <head> <title><?=$sitename?></title> </head> <body> <h1><?=$sitename?></h1 Is technically correct if you are only going to echo one item, however it is commonly considered bad practice because php must have short tags enabled. Now onto the answer, I'm not entirely sure what the question was if you could please explain in more detail. Quote Link to comment https://forums.phpfreaks.com/topic/115172-php-code-helpplease-help/#findComment-592306 Share on other sites More sharing options...
ljzxtww Posted July 17, 2008 Author Share Posted July 17, 2008 <html> <head> <title><?=$sitename?></title> </head> <body> <h1><?=$sitename?></h1 Is technically correct if you are only going to echo one item, however it is commonly considered bad practice because php must have short tags enabled. Now onto the answer, I'm not entirely sure what the question was if you could please explain in more detail. my config.php code following: my settings will be stored in a file called "config.php." <? $sitename = ""; // site name $siteurl = ""; // site url $redirecturl = ""; // redirect url $affpay = ""; // affiliate payout amount $aduser = ""; // admin username $adpass = ""; // admin password $dbhost = ""; // database hostname $dbuser = ""; // database username $dbpassword = ""; // database password $dbname = ""; // database name ?> i want to use config.php code follwing: $sitename = ""; // site name I want to print on page index.php <html> <head> <title><?=$sitename?></title> </head> <body> <h1><?=$sitename?></h1> this one is clear :) :) lary Quote Link to comment https://forums.phpfreaks.com/topic/115172-php-code-helpplease-help/#findComment-592473 Share on other sites More sharing options...
trq Posted July 17, 2008 Share Posted July 17, 2008 Your question still lacks detail. I'll have a guess. <?php include 'config.php'; ?> <html> <head> <title><?php echo $sitename; ?></title> </head> <body> <h1><?php echo $sitename; ?></h1> Quote Link to comment https://forums.phpfreaks.com/topic/115172-php-code-helpplease-help/#findComment-592478 Share on other sites More sharing options...
ljzxtww Posted July 17, 2008 Author Share Posted July 17, 2008 Your question still lacks detail. I'll have a guess. <?php include 'config.php'; ?> <html> <head> <title><?php echo $sitename; ?></title> </head> <body> <h1><?php echo $sitename; ?></h1> hi: is very good work. right now is working, but how to put mysql and pring from index.php I try lots time, still not work larry Quote Link to comment https://forums.phpfreaks.com/topic/115172-php-code-helpplease-help/#findComment-592726 Share on other sites More sharing options...
compguru910 Posted July 17, 2008 Share Posted July 17, 2008 What you would want to to is create a table in PHPmyAdmin, that has something like id, page_name, title for the rows. Then, you would want to run a query that searches for only that page name, like this (mind the shorthand) <? //Code to connect to database here $query = "SELECT title FROM table WHERE page_name = '{$_SERVER['self']}';"; $returned = mysql_query($query); $rows = mysql_fetch_array($returned) print "<title>{$rows[0]}</title>"; mysql_close(); ?> Thats the gist of it. Hope it helps. Hope someone else that reads this gets what I wrote that that they can help him if mine doesnt Quote Link to comment https://forums.phpfreaks.com/topic/115172-php-code-helpplease-help/#findComment-592835 Share on other sites More sharing options...
ljzxtww Posted July 17, 2008 Author Share Posted July 17, 2008 What you would want to to is create a table in PHPmyAdmin, that has something like id, page_name, title for the rows. Then, you would want to run a query that searches for only that page name, like this (mind the shorthand) <? //Code to connect to database here $query = "SELECT title FROM table WHERE page_name = '{$_SERVER['self']}';"; $returned = mysql_query($query); $rows = mysql_fetch_array($returned) print "<title>{$rows[0]}</title>"; mysql_close(); ?> Thats the gist of it. Hope it helps. Hope someone else that reads this gets what I wrote that that they can help him if mine doesnt not work at all get wrong messenge but thank you anyway.. you help me to figure out can you guy think anther way larry Quote Link to comment https://forums.phpfreaks.com/topic/115172-php-code-helpplease-help/#findComment-592913 Share on other sites More sharing options...
trq Posted July 17, 2008 Share Posted July 17, 2008 You need to read some tutorials or something, were not personal tutorial writters. Theres a good link in my sig to a site called Hudzilla, read it. Quote Link to comment https://forums.phpfreaks.com/topic/115172-php-code-helpplease-help/#findComment-592920 Share on other sites More sharing options...
ljzxtww Posted July 18, 2008 Author Share Posted July 18, 2008 You need to read some tutorials or something, were not personal tutorial writters. Theres a good link in my sig to a site called Hudzilla, read it. I can not fought the tutor about my topic is aboout please somebody help me thank you larry Quote Link to comment https://forums.phpfreaks.com/topic/115172-php-code-helpplease-help/#findComment-593141 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.