addressalign-toparrow-leftarrow-rightbackbellblockcalendarcameraccwcheckchevron-downchevron-leftchevron-rightchevron-small-downchevron-small-leftchevron-small-rightchevron-small-upchevron-upcircle-with-checkcircle-with-crosscircle-with-pluscontroller-playcrossdots-three-verticaleditemptyheartexporteye-with-lineeyefacebookfolderfullheartglobegmailgooglegroupshelp-with-circleimageimagesinstagramFill 1light-bulblinklocation-pinm-swarmSearchmailmessagesminusmoremuplabelShape 3 + Rectangle 1ShapeoutlookpersonJoin Group on CardStartprice-ribbonprintShapeShapeShapeShapeImported LayersImported LayersImported Layersshieldstartickettrashtriangle-downtriangle-uptwitteruserwarningyahoo
A former member
Post #: 1
Hi i really need some help with indexing high volume sites. All of you have seen sites where the url might look like this "yourdomain.com/?ID=page100" where that brings you to a different page when the number changes. Example of what i need help with:

yourdomain.com/?ID=page100 potentially goes to HOME
yourdomain.com/?ID=page101 potentially goes to SERVICES
yourdomain.com/?ID=page102 potentially goes to PRODUCTS
yourdomain.com/?ID=page103 potentially goes to LISTINGS
yourdomain.com/?ID=page104 potentially goes to FORUM
yourdomain.com/?ID=page105 potentially goes to CONTACT


So how do i do this using a MySQL database or at least some sort of php code to help index high volume sites. Please help, ive tried answers.yahoo.com and every type of search possible and cant figure out how to do this. PLZ HELP!!!!!!
A former member
Post #: 10
Hey there,

Let's say you have a MySQL table like this (simple ids linked to specific relative URLs):

id       url

100    home.html
101    pages/services.html
102    pages/products.html
103    pages/listings.html
104    forum.cgi
105    pages/contact.html

Then, in your index page you'd have code to retrieve a specific GET variable (the page identifier) from the current URI (which may be something like http­://yourdomain.com/?pageid=100). You would then connect to MySQL and run a simple SELECT query to retrieve the URL linked to the page identifier. And finally, either include the URL in the current page or redirect the page.

<?php
// Remove any non-digits from page id
$id = preg_replace("/[^0-9]/", "", $_GET['pageid']);

if ($id === "")
   {
   die("Missing or invalid page id");
   }

$query = "SELECT url FROM table WHERE id = ".$id;
$result = mysql_query($query);

$url = @mysql_result($result, 0, 0) or die("Couldn't find page!");

include($url);
?>

Having a ton of static pages is not very efficient, though. A better idea is to create a few pages to control display along with other backend programs, and store everything else in your database. A good example of this is PHPBB.

Travis
A former member
Post #: 2
Travis,

Thank you very much. I think ive asked this question about 20 times over the net and no one has given me a good answer, Thank you. I will get on tonight and test out your code you have given to me. Ill get back to you if i cant get it to work,
thanks again

ALEX~
A former member
Post #: 3
Hey Travis I could not get it to work here is the link to my testing server TESTING SERVER . and here is the code i used:

<?php
// Remove any non-digits from page id
# FileName="Connection_php_mysql.htm"­
# Type="MYSQL"
# HTTP="true"
$hostname_MySQL = "mysqlhost";
$database_MySQL = "d60253838";
$username_MySQL = "";
$password_MySQL = "";
$MySQL = mysql_pconnect($hostname_MySQL, $username_MySQL, $password_MySQL) or trigger_error(mysql_error(),E_USER_ERROR­);


$id = preg_replace("/[^0-9]/", "", $_GET['id']);

if ($id === "")
{
die("Missing or invalid page id");
}

$query = "SELECT url FROM id WHERE id = ".$id;
$result = mysql_query($query);

$url = @mysql_result($result, 0, 0) or die("Couldn't find page!");

include($url);
?>

i made a database with 2 tables: id & url

In the ID table i put the corresponding number 100-110
In the URL table i put the pages home.php, index.php, contacts.php, and so on until i got to ten pages.

Any suggestions?

--------

Edit by Travis: Removed your db credentials from your post. Didn't think you'd want to display that. :)
A former member
Post #: 12
You really only need one MySQL table (perhaps named "links"). In this table, you'll need two columns: "id" and "url". Then, change your PHP/SQL code to this:

$query = "SELECT url FROM links WHERE id = ".$id;

That will retrieve the url corresponding to the supplied page id.
A former member
Post #: 4
In the table called "links" i make 2 fields, "id" & "url"...

What...
type?
function?
...of those 2 fields should they be. and then where do i enter in the id like 100,101,102
and then where do i put the url like index.php, home.php,contact.php?
Thanks
ALEX
A former member
Post #: 14
Come to the meetup tomorrow night, and I'll help you with this. smile

Travis
Powered by mvnForum

Our Sponsors

  • Codeup

    Codeup generously offers their space and pizza for every meetup!

  • Web & Mobile App Consultants

    Grok Interactive provides media management and beer for every meetup!

  • Turner Logic

    Supports SAWD. Web and Mobile Development Experts.

  • Community CIO

    Solving technology needs for nonprofit organizations in San Antonio.

People in this
Meetup are also in:

Sign up

Meetup members, Log in

By clicking "Sign up" or "Sign up using Facebook", you confirm that you accept our Terms of Service & Privacy Policy