php - How to create 4 dymanic pages using database values -
i have 4 pages(about, interviews, ask q, contact) per people , have 250+ people , takes long time create new people site
what best way have 4 pages(about, interview, ask q, contact) loops through database people , creates pages on fly when user requests them?
here's example of person on site http://starsqa.com/aaron-cole
i'm thinking of using $_get variables database , changing url using .htaccess rewriting, have no clue how or if it's possible
the site uses html, php, mysql , oop
what best way achieve this?
i have added this:
<?php session_start(); error_reporting(e_all ^ e_notice); include("db_conn.php"); $qry_string = "select * stars inner join roles on roles.starid = stars.starid stars.starid = ?"; $prep = $pdo_conn->prepare($qry_string); $prep->execute(array($_get['id'])); $result = $prep->fetch(pdo::fetch_assoc); $pieces = explode(" ", $result['starname']); $gender = "him"; ?>
and if use http://www.starsqa.com/about?id=52 can aaron cole , id=6 lindsey mckeon
how figure out how change url http://www.starsqa.com/about?id=52 http://starsqa.com/aaron-cole-about
tried this, didn't seem work: sending user starsqa.com/aaron-cole-about starsqa.com/about?id=52) :
rewritecond %{query_string} ^$ rewriterule ^/aaron-cole-about$ /about?id=52 [l]
here's current .htaccess file
options -multiviews rewriteengine on rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewritecond %{request_filename} !\.php$ rewriterule ^(.*)$ $1.php [l,qsa] rewritecond %{query_string} ^$ rewriterule ^/aaron-cole-about$ /about?id=52 [l]
is possible user entered in aaron-cole-about , behind scenes uses about?id=52 still shows user aaron-cole-about ???
even though cannot termed strict duplicate, answer idea.
how create unique php page each row in mysql database
both answers allow create pages. though need 4 pages per record, should not different loop through them.
then rules similar 1 below
rewriterule ^about/([^/]+)_([^?/]+).html /about.php?personid=$2
the first part ^about says url http://yoursite.com/about/ should use rule. in url http://yoursite.com/about/xxxx_1234.html first part ([^/]+) , ([^?/]+) indicate split actual url xxxx 1234 , html rule redirect user about.php?personid=1234
a combination of these 2 should you. hope helps
Comments
Post a Comment