-2
Warning: odbc_exec(): SQL error: [MySQL][ODBC 5.3(w) Driver][mysqld-5.6.24]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 '1 ID,category,Image1 FROM 3dprints WHERE category='model_making' ORDER' at line 1, SQL state 37000 in SQLExecDirect.
public function get_max_category($category){
$query="SELECT TOP 1 ID,category,Image1
FROM ".$this->tblname." WHERE category='".$category."'
ORDER BY Date_of_creation DESC";
$exec=odbc_exec($this->cnx,$query);
$id=odbc_result($exec,'ID');
$category=odbc_result($exec,'category');
$img1=odbc_result($exec,'Image1');
return array($id,$category,$img1);
}
public function get_category(){
$query="SELECT DISTINCT(category) FROM ".$this->tblname;
$exec=odbc_exec($this->cnx,$query);
while($row=odbc_fetch_row($exec)){
$categories[]=odbc_result($exec,'category');
}
return $categories;
}
感謝它的工作。無論如何,我認爲我的問題是我使用舊的語法。感謝sadikhasan, –