Jump to content

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/115172-php-code-helpplease-help/
Share on other sites

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.

<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.

<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

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

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

 

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.