Reputation: 33
I'm doing my homework and we're supposed to do registration, and i'm stuck at combobox, it does show something but it shows a blank , we're prohibited to use mysql_query, and any other object than PDO.
$query = "SELECT * FROM tbltypkon";
$result = $db->query($query);
while($row=mysql_fetch_array($result, MYSQL_ASSOC)){
echo "<option value='".$row['ID_TYPKON']."'>".$row['TYPKONTAKTU']."</option>";
}
Upvotes: 1
Views: 197
Reputation: 6857
Instead of
$row = mysql_fetch_array($result, MYSQL_ASSOC)
you should use
$row = $result->fetch(PDO::FETCH_ASSOC)
see PDOStatement::fetch in the PHP Manual.
Upvotes: 1