Portal Home > Knowledgebase > Articles Database > Parse error: syntax error, unexpected $end


Parse error: syntax error, unexpected $end




Posted by NextDoorWebHosting, 11-26-2011, 08:55 PM
Hello, I have this code and i cant seem to find anything wrong with it relating to the error Parse error: syntax error, unexpected $end in C:\wamp\www\loginform.php on line 31 Will you please look at the code and see if you can give me a little help? Thanks in advanced!

Posted by ThatScriptGuy, 11-26-2011, 09:26 PM
should be

Posted by NextDoorWebHosting, 11-26-2011, 09:36 PM
Thank you so much! That fixed that, i fixed a few more problems then i got this other error that i have no idea about. Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\wamp\www\loginform.php on line 18 any more advice?

Posted by ThatScriptGuy, 11-26-2011, 09:37 PM
That means that something is wrong with your query. Change to and report back.

Posted by NextDoorWebHosting, 11-26-2011, 09:39 PM
It gave me Unknown column 'username' in 'where clause'

Posted by ThatScriptGuy, 11-26-2011, 09:40 PM
So that's your problem. In the table that you're querying, there isn't a column named 'username'

Posted by NextDoorWebHosting, 11-26-2011, 09:45 PM
aha just looked at my table again. It was a simple mistake that i looked over! Thank you so much for your time i really apreciate it!

Posted by Matt R, 11-29-2011, 07:03 AM
Also, in the future, it's a good idea to run a check on the MySQL query before relying on mysql_num_rows(). If mysql_query() comes out NULL or FALSE rather than a value of 0 in the row count (such as if there was an error), you'll end up with errors thrown all over your website. Try... You could also use a try/catch statement, which is usually the better idea. Either way: You need some level of error checking/catching. If something goes wrong, it's best to keep it as hidden as possible.

Posted by NextDoorWebHosting, 11-30-2011, 12:01 AM
Thanks! Great info.



Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read
Nginx vs Lighttpd (Views: 610)
Update Partition size (Views: 565)
DoS Problems (Views: 581)