Here is the sitch...
I am building a site that will consist of a domain and a variable number of subdomains.
I have built in some php code to be able to display domain wide and subdomain specific messages to the visitors. The messages have a start date and an end end date. On the index page for the domain the code works great. On the subdomain it doesn't work. I have tried everything I can think of to make it work but am getting nowhere.
The only difference is that with the subdomain the SELECT statement is on an external page that is included. I don't want to have to go back in to x number of subdomains to make any changes or updates - just change one file.
I just changed hosts (didn't work on the old host either).:queasy:
Here is the error I get:
[INDENT]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND CURRENT_DATE() BETWEEN adminmessagestart AND adminmessageend' at line 1[/INDENT]
So, the external file is being included and parsed.
Here is the code for the main page:
mysql_select_db($database_ywronnetfirms, $ywronnetfirms);
$query_admin_message = "SELECT adminmessage.adminmessagetitle, adminmessage.adminmessage, adminmessage.adminmessageapplytosite FROM adminmessage WHERE adminmessageapplytosite = 0 OR adminmessageapplytosite = $row_thissite[sitesidx] AND CURRENT_DATE() BETWEEN adminmessage.adminmessagestart AND adminmessage.adminmessageend ORDER BY adminmessage.adminmessageidx";
$admin_message = mysql_query($query_admin_message, $ywronnetfirms) or die(mysql_error());
$row_admin_message = mysql_fetch_assoc($admin_message);
$totalRows_admin_message = mysql_num_rows($admin_message);
Heres is the code from the subdomain template...
mysql_select_db($database_ywronnetfirms, $ywronnetfirms);
$query_admin_message = "SELECT adminmessage.adminmessagetitle, adminmessage.adminmessage, adminmessage.adminmessageapplytosite FROM adminmessage WHERE adminmessageapplytosite = 0 OR adminmessageapplytosite = $row_thissite[sitesidx] AND CURRENT_DATE() BETWEEN adminmessage.adminmessagestart AND adminmessage.adminmessageend ORDER BY adminmessage.adminmessageidx";
$admin_message = mysql_query($query_admin_message, $ywronnetfirms) or die(mysql_error());
$row_admin_message = mysql_fetch_assoc($admin_message);
$totalRows_admin_message = mysql_num_rows($admin_message);
Here is the code I am trying to use to inlcude the php page in the actual template...
<?php require_once('includes/header.php'); ?>
<?php require_once('includes/admin-messages.php'); ?>
<?php require_once('includes/static-pages.php'); ?>
<?php require_once('includes/left-nav.php'); ?>
<?php require_once('includes/index-center.php'); ?>
<?php require_once('includes/right-nav.php'); ?>
<?php require_once('includes/footer.php'); ?>
"$row_thissite[sitesidx]" is currently pulled from the database - however - in the subdomains it will be loaded from a subdomain configuration file.
Anyone see anything or have some suggestions?
Thanks in advance.