Jump to content

Will this really work?


happypete

Recommended Posts

Hi,

 

I'm designing a site that contains mini-sites on sub-domains: 1.site.com, 2.site.com, 3.site.com etc...

 

Each site will use the following script to extract the sub-domain:

 

<?php
$subdir = basename(dirname(__FILE__));
echo "$subdir";
?>

 

and everything will revolve around this number, so for www.1.site.com $subdir equals 1

 

I will then use this number to relate to the table 'id' within the database to extract data:

 

$sql = "SELECT title
        FROM data
        WHERE id=$subdir"; 

 

so 1.site.com will call data from the database with id=1

 

I then use an addon domain on the sub-domain ie: thisdomain.com = 1.site.com, so thisdomain.com will extract data with id=1 from the database.

 

so my question, will this work and will it be reliable?

Link to comment
Share on other sites

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.