Jump to content

Search the Community

Showing results for tags 'metatags'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 1 result

  1. I have a basic MySQL database setup holding relevant meta information for a few pages, starting small, I want the meta information to load dynamically depending on the page that the user is viewing. I have the connection script working fine, I have echoed the data out via variables and everything is looking good however I am now at the stage where I want to echo that data out on the page in the relevant fields but cannot seem to get it working. So far I have <?php include 'connect.php'; $title = 'page_title'; $pname = 'page_name'; $desc = 'meta_description'; $key = 'meta_keywords'; $aut = 'author'; $copyr = 'copyright'; $email = 'email'; $rating = 'rating'; $robots = 'robots'; $visit = 'revisit'; $exp = 'expires'; $dist = 'distribution'; $query = $db->query("SELECT * FROM meta_data"); while ($row = $query->fetch(PDO::FETCH_ASSOC)){ echo $row[$pname] . '<br>'; echo $row[$title]. '<br>'; echo $row[$desc]. '<br>'; echo $row[$key]. '<br>'; echo $row[$aut]. '<br>'; echo $row[$copyr]. '<br>'; echo $row[$email]. '<br>'; echo $row[$rating]. '<br>'; echo $row[$robots]. '<br>'; echo $row[$visit]. '<br>'; echo $row[$exp]. '<br>'; } ?> The while loop was just testing that I was getting the data, it echoes out fine, although I do get every page in the DBase. I then have <link rel="apple-touch-icon" href="apple_touch_icon.png"/> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="description" content="<?php echo $desc; ?>" /> <meta name="keywords" content="<?php echo $key; ?>" /> <meta name="copyright" content="<?php echo $copyr; ?>" /> <meta name="author" content="<?php echo $aut; ?>" /> <meta name="email" content="<?php echo $email; ?>" /> <meta name="Distribution" content="<?php echo $dist; ?>" /> <meta name="Rating" content="<?php echo $rating; ?>" /> <meta name="Robots" content="<?php echo $robots; ?>" /> <meta name="Revisit-after" content="<?php echo $visit; ?>" /> <meta name="expires" content="<?php echo $exp; ?>" /> <link rel="shortcut icon" href="favicon.ico" type="image/icon" /> <!-- favicon for browser, the image is .ico file in root directory--> <title><?php echo $title; ?></title> As it stands at the moment all I get in the page fields is the database field name but as I say I get the data from the database when echoing the row. Could someone advise me where I am going wrong and steer me in the right direction to get the appropriate data for the page in question? Thanks for any help.selectdata.phphome.php
×
×
  • 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.