Jump to content

[SOLVED] displaying individual store names in meta name


raven2009

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

Archived

This topic is now archived and is closed to further replies.

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