正如我寫這段代碼$this->setlist();
是這個錯誤,在寫這行之前我沒有遇到任何錯誤,你能幫忙嗎我有這個嗎?你的SQL語法有錯誤;檢查與您的MySQL服務器版本相對應的手冊,在第1行的'1'附近使用正確的語法
public function setlist(){
$mysql = new Mysql();
$query = "SELECT * FROM student where cohortid = '$this->cohort' && programid = '$this->program && departmentid = '$this->department'";
$mysql->execute($query);
while($row = $mysql->fetch_array()){
$this->list[] = $row;
}
array_unshift($this->list, "test");
unset($this->list[0]);
}
public function display_id_firstname_and_lastname(){
*$this->setlist();*
$html = new Html();
$html->table("table table-bordered");
$html->row();
$html->column(); echo "S#"; $html->closecolumn(); $html->column(); echo "FirstName"; $html->closecolumn(); $html->column(); echo "LastName"; $html->closecolumn();
$html->closerow();
foreach($this->list as $key => $value){
$html->row();
$html->column(); echo $key; $html->closecolumn(); $html->column(); echo $value['firstname']; $html->closecolumn();
$html->column(); echo $value['lastname']; $html->closecolumn();
$html->closerow();
}
$html->closetable();
}
您可以在執行它之前'echo'SQL。 – Mureinik
''$ this-> program' <<<就在那裏。 –
感謝隊友,它解決了@ Fred-ii- –