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_idint(11) NOT NULL AUTO_INCREMENT,cat_namechar(50) NOT NULL, PRIMARY KEY (cat_id) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=11 ;table tblcontent
CREATE TABLE IF NOT EXISTS
tblcontent(con_idint(11) NOT NULL AUTO_INCREMENT,titlechar(100) NOT NULL,descriptiontext NOT NULL,date_posteddate NOT NULL,authorchar(50) NOT NULL,cat_idint(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_idint(11) NOT NULL AUTO_INCREMENT,con_idint(11) NOT NULL,img_namevarchar(250) NOT NULL,img_thumvarchar(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