Click here to Skip to main content
12,818,325 members (43,000 online)
Rate this:
Please Sign up or sign in to vote.
See more: PHP
what's this error :syntax error, unexpected T_CLASS
this is a part of my code :
	$connection2 = mysql_connect("localhost","login_h","1234");
	$db = "login_sys";
	mysql_select_db($db , $connection2) 
class Blogpost{
		public $id;
		public $title;
		public $post;
		public $author;
		public $tags;
		public $dateposted;
		public $images;
Posted 10-Sep-12 12:24pm
Updated 10-Sep-12 12:31pm
enhzflep 10-Sep-12 17:27pm
It's a syntax error, which, without context means pretty much nothing.
Like C, the error can appear to point to a line that's some distance away from the actual error. If you could show the smallest example of code that exhibits this error, you're likely to get a prompt response. :)

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

It looks like you've missed the ; from the mysql_select_db line.
Sine this line isn't terminated, the PHP pre-processor is surprised to see
class Blogpost

Hence the message 'unexpected T_CLASS'
Hysen Ndregjoni 10-Sep-12 17:51pm
thanks a lot !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
enhzflep 10-Sep-12 18:02pm
You're welcome. :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.170308.1 | Last Updated 10 Sep 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100