Question:
PHP Parse error: syntax error, unexpected T_STRING in C:\Inetpub\wwwroot\example.php on line 8?
jam
2007-10-06 08:03:08 UTC
Hi
I get the above error in the following code, the line with the error seems to be:
$test-> sql = "SELECT body FROM test.articles";

full code:
phpinfo();

include("C:\Inetpub\wwwroot\my_pagina_class.php");
$_SERVER['DOCUMENT_ROOT'] = "C:\Inetpub\wwwroot\";

$test = new MyPagina;
$test-> sql = "SELECT body FROM test.articles";
$result = $test->get_page_result();
$num_rows = $test->get_page_num_rows();
$nav_links = $test->navigation(" | ", "currentStyle");
$nav_info = $test->page_info("to");
$simple_nav_links = $test->back_forward_link();
$total_recs = $test->get_total_rows();
?>

when i refresh the example.php page i get the following error:

Error in my_thread_global_end(): 1 threads didn't exit PHP Parse error: syntax error, unexpected T_STRING in C:\Inetpub\wwwroot\example.php on line 8

global variables parameter in php.ini is on, so i dont understand why it doesnt work.

I am a php newbie,
Thanks in advance

kind regards

Tovia Singer
Five answers:
Wiseguy
2007-10-06 08:28:56 UTC
There's a space in "$test-> sql" when it should be "$test->sql." Remove it. :-)



#########

Update:



Okay, since that doesn't fix the error, the error is triggered before it gets to that part! (The space thing would have also caused an error.)



In the line before it:

$test = new MyPagina;

Try adding parentheses:

$test = new MyPagina();



I didn't think that's necessary, but it's worth a shot.



###########

Update 2:



Maybe the problem is on the line we can't see?

include(...
Refined
2007-10-08 02:54:44 UTC
Hello jam,



Error in my_thread_global_end(): 1 threads didn't exit PHP Parse error: syntax error, unexpected T_STRING in C:\Inetpub\wwwroot\example.php on line 8



The my_thread_global_end() error message above refers to one of two things (and hopefully not both!). The problem is either your PHP script or your MySQL version. If it's your PHP code, the problem is that somewhere mysql_thread_init() is being called to create a new MySQL thread but mysql_thread_end() is not being called to close it when it's not needed anymore. MySQL won't automatically close this for you and therefore throws the error that you see.



Try checking your mypagina class for the mysql_thread_init() function and see if the thread is being correctly closed. If you can't find it, at the end of the method which calls the MySQL query, add a mysql_thread_end() function call anyway, to make sure the thread is closed. Just because you can't find any calls to mysql_thread_init() doesn't mean it's not being used: it's also called by some other core PHP functions.



If it is your MySQL version, you will need to apply this patch: http://lists.mysql.com/commits/25160. Or just upgrade to the latest stable release.



For more information there is a long discussion on this error/bug at http://bugs.mysql.com/bug.php?id=25621. It will most likely be worth you reading this.



The 'PHP Parse error: syntax error, unexpected T_STRING' error message may or may not be related: it usually refers to a PHP command declaration not being following by a semi colon (all lines in PHP must be finished by a semi colon (;)).



And BTW, you don't necessarily need to follow class instantiations with paranthesis' (mypagina or mypagina() are the same unless the mypagina class has a constructor which requires arguments).



Hope it helps,

Refined.
cherish
2016-05-17 13:00:14 UTC
Can you post the full path to your file. This line contains important information that can help fix the error. /home/a5773398/public_html/Saudi_House... on line 1
anonymous
2007-10-10 01:20:44 UTC
Remove space here: $test-> sql

~~~~~
anonymous
2007-10-07 00:33:44 UTC
$test-> sql = "SELECT body FROM test.articles";



it should be

$test->sql = "SELECT `body` FROM test";


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...