I have page1 that uses that 'includes' page2. Page2 uses an 'include' for page3. Page3 needs a variable that is set on page1 before page2 is included. Pages 1-3 are all located within different subdirectories of the web site.
// PAGE1
// http://www.domain.com/page1.php
$g=1;
$w=500;
include "page2.php";
// PAGE2
// http://www.domain.com/sub1/sub2/sub3a/page2.php
// stuff here prior to include
include "../../../page2.php";
// stuff here after include
// PAGE3
// http://www.domain.com/sub1/sub2/sub3b/page3.php
$query = "SELECT * FROM table WHERE rotations_id = ".$g;
echo $query."<br>";
mysql_db_query($db, $query) or die(mysql_error());
The error it gives me is:
SELECT * FROM table WHERE rotations_id =
You have an error in your SQL syntax near '' at line 1
which is because the variable $g did not get passed.
So here's my question. Why isn't the variable passing to the query and how do I get it to do so?
BD