Jump to content

Recommended Posts

right ill try and make this easy to understand im not good at explaining things :)

 

when i make a new store page its gets a new id  e.g.  store.php?id=254

 

now when i index the pages via google it comes up with the name of the main stores name e.g

 

my site name - stores

 

and thats displays a few hundred times

 

how do i get it to display individual names of stores in the meta name (top of page) e.g

 

my site name - Auto trader

Something like this:

 

blah.php

<?php
$meta_name = '';
$id = intval($_GET['id']);
if (!empty($id)) {
     $sql = 'SELECT meta FROM tablename WHERE id=' . $id . ' LIMIT 1';
     $result = mysql_query($sql);
     $result = mysql_fetch_assoc($sql);
     $meta_name = $result['meta'];
}
?>
<html>
     <head>
          <meta name="description" content="<?php echo $meta_name; ?>" />
     </head>
     <body>
     </body>
</html>

 

There's an example.

Something like this:

 

blah.php

<?php
$meta_name = '';
$id = intval($_GET['id']);
if (!empty($id)) {
     $sql = 'SELECT meta FROM tablename WHERE id=' . $id . ' LIMIT 1';
     $result = mysql_query($sql);
     $result = mysql_fetch_assoc($sql);
     $meta_name = $result['meta'];
}
?>
<html>
     <head>
          <meta name="description" content="<?php echo $meta_name; ?>" />
     </head>
     <body>
     </body>
</html>

 

There's an example.

 

 

thanks for that heres a sample of my code trouble is the id is just a number would i replace id with retailer name?

 

thanks for your help  ;)

 

 

 

$id=$_GET['id'];
$retailers="select * from retailers where id='$id'";
$listRetailers=mysql_query($retailers);	

while($row=mysql_fetch_array($listRetailers))
{

$id=$row['id'];              
$retailername=$row['retailername'];     
$category=$row['category'];          
$keywords=$row['keywords'];      

I guess. I'm not sure what data your DB has, but give it a try. :)

 

yesssssss i did it :)

 

i did the information you told me but it displayed just the retailer number so i added  <?php echo $retailername; ?> in to the title and it worked  ;D i'm well happy

 

Thanks for your supprt  ;D

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.