happypete Posted February 16, 2010 Share Posted February 16, 2010 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? Quote Link to comment https://forums.phpfreaks.com/topic/192224-will-this-really-work/ Share on other sites More sharing options...
trq Posted February 16, 2010 Share Posted February 16, 2010 In theory it should work. Given the option I would likely have a different db for each site, but there's probably nothing wrong with the method you are describing. Quote Link to comment https://forums.phpfreaks.com/topic/192224-will-this-really-work/#findComment-1012977 Share on other sites More sharing options...
happypete Posted February 16, 2010 Author Share Posted February 16, 2010 thanks thorpe Quote Link to comment https://forums.phpfreaks.com/topic/192224-will-this-really-work/#findComment-1013177 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.