Everybody . please help me. Now I'm working with pagination.. I want to display 5 records per page depending on the tblcategory.cat_id . but my query string has problem..
table tblcategory
CREATE TABLE IF NOT EXISTS
tblcategory
(cat_id
int(11) NOT NULL AUTO_INCREMENT,cat_name
char(50) NOT NULL, PRIMARY KEY (cat_id
) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=11 ;table tblcontent
CREATE TABLE IF NOT EXISTS
tblcontent
(con_id
int(11) NOT NULL AUTO_INCREMENT,title
char(100) NOT NULL,description
text NOT NULL,date_posted
date NOT NULL,author
char(50) NOT NULL,cat_id
int(11) NOT NULL, PRIMARY KEY (con_id
), KEYcat_id
(cat_id
) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=78 ;table tblimage
CREATE TABLE IF NOT EXISTS
tblimage
(img_id
int(11) NOT NULL AUTO_INCREMENT,con_id
int(11) NOT NULL,img_name
varchar(250) NOT NULL,img_thum
varchar(250) NOT NULL, PRIMARY KEY (img_id
), KEYcon_id
(con_id
) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=9 ;
this is my query string , so what's wrong with my sql statement.
SELECT * FROM tblcontent LEFT JOIN tblcategory
ON (tblcontent.cat_id = tblcategory.cat_id)
LEFT JOIN tblimage ON (tblimage.con_id = tblcontent.con_id)
ORDER BY tblcontent.date_posted DESC
LIMIT 0,5 WHERE tblcategory.cat_id=1
The Result is : Error Code : 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE tblcategory.cat_id=1' at line 5