| | |
Tabs causing errors
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Jun 2005
Posts: 2
Reputation:
Solved Threads: 0
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:
If I take the tabs out, it looks like this, and get no errors:
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?
Here is the original code after I replaced the tabs with spaces:
PHP Syntax (Toggle Plain Text)
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:
PHP Syntax (Toggle Plain Text)
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?
![]() |
Similar Threads
- memory management in wndows 2000 (Windows NT / 2000 / XP)
- errors showing up when page isn't running (PHP)
- Generic host error (Viruses, Spyware and other Nasties)
- Do you have a bridge.dll error? Read this! (Viruses, Spyware and other Nasties)
- Virus causing errors (Viruses, Spyware and other Nasties)
- Blue Screen Error Shows Up Repeatedly (Troubleshooting Dead Machines)
Other Threads in the PHP Forum
- Previous Thread: I'm looking for a certain type of script (desc. within)
- Next Thread: How to run web PHPscript in specified user?
| Thread Tools | Search this Thread |
# 5.2.10 alexa apache api array beginner binary broken cakephp checkbox class clean clients cms code cron curl database date directory display dissertation dynamic echo echo$_get[x]changingitintovariable... email encode error fairness file files folder form forms function functions google href htaccess html image images include indentedsubcategory insert ip javascript joomla legislation limit link local login mail memberships menu mlm multiple multipletables mysql mysqlquery newsletters oop open paypal pdf persist php problem provider query radio random recursion remote rss script search server sessions simple sms sockets source space spam sql syntax system table tutorial update upload url validator variable video web youtube





