私はPHPを使用したPDOを初めて使用しますが、あなたの助けが必要です。selectステートメントを使用して関数を作成しましたが、クエリの値が0より大きい場合は、フェッチを返します。
$this->result->setFetchMode(PDO::FETCH_OBJ);
if ($this->result->rowCount() > 0) {
return $this->result->fetch();
}
そして私のメインプログラムで私はこれを持っています
foreach ($category_results as $row){
echo .$row['id_category'].' '. $row['name'];
}
this command echo only 1 and F twice but if i put only $row it echo all the results correct e.g 1 Food, 2 Drinks. how i can echo the results separately like the example i have above? i want to put them in a list box
thank you