I've been getting errors by putting tabs in my script to make it a little easier to read and more organized. As soon as I take the tabs out, the errors go away but the script is very ugly. I even tried using 4 spaces in place of the tabs and that did not work.
Here is the original code after I replaced the tabs with spaces:
while($category = _fetchobj($col1_category_query)) {
$col1_subcat_query = "SELECT id,name FROM categories WHERE parentid = '$category->id'";
$col1_subcat_result = _query($col1_subcat_query);
$subcat_list = "<b>Sub-Categories:</b><br>";
while($subcat = _fetchobj($col1_subcat_result)) {
$subcat_list .= <<<EOT
<b><a href="viewcat.php?id=$subcat->id">$subcat->name</a></b><br>
EOT;
}
$col1_link_query = "SELECT id,name,parentcat,category FROM links WHERE parentcat = '$category->id' LIMIT 0,5";
$col1_link_result = _query($col1_link_query);
$link_list = "<i>First 5 Sites:</i><br>";
while($link = _fetchobj($col1_link_result)) {
$link_list .= <<<EOT
<a href="go.php?id=$link->id">$link->name</a><br>
EOT;
}
$col1 = <<<EOT
<table border="0" width="100%" id="table1" cellspacing="0" style="border: 1px solid #DADADA"><tr><td align="center" bgcolor="#DADADA">$category->name</td></tr><tr><td align="center" bgcolor="#F8F8F8">$subcat_list<br>$link_list</td></tr></table>
EOT;
}
If I take the tabs out, it looks like this, and get no errors:
while($category = _fetchobj($col1_category_query)) {
$col1_subcat_query = "SELECT id,name FROM categories WHERE parentid = '$category->id'";
$col1_subcat_result = _query($col1_subcat_query);
$subcat_list = "<b>Sub-Categories:</b><br>";
while($subcat = _fetchobj($col1_subcat_result)) {
$subcat_list .= <<<EOT
<b><a href="viewcat.php?id=$subcat->id">$subcat->name</a></b><br>
EOT;
}
$col1_link_query = "SELECT id,name,parentcat,category FROM links WHERE parentcat = '$category->id' LIMIT 0,5";
$col1_link_result = _query($col1_link_query);
$link_list = "<i>First 5 Sites:</i><br>";
while($link = _fetchobj($col1_link_result)) {
$link_list .= <<<EOT
<a href="go.php?id=$link->id">$link->name</a><br>
EOT;
}
$col1 = <<<EOT
<table border="0" width="100%" id="table1" cellspacing="0" style="border: 1px solid #DADADA"><tr><td align="center" bgcolor="#DADADA">$category->name</td></tr><tr><td align="center" bgcolor="#F8F8F8">$subcat_list<br>$link_list</td></tr></table>
EOT;
}
My scripts have always done this so I usually just make it ugly and remove the tabs just so I don't get the error.
I use the editor Notepad++ and have tried copying the code into Notepad and then saving the file using notepad and that doesn't work either so I guess it's not Notepad++.
The error I get is:
Parse error: parse error, unexpected $ in /index.php on line 102 (102 is last line of the script that only has the closing tag ?>)
Can someone please help me?