PDO - Changing old mysql_fetch_object

mysql, pdo

Solution

You should change it to :

while($row = $result->fetch(PDO::FETCH_OBJ)){
...
}

You will find more information about it here : PDOStatement Fetch

It is a good choice to change for PDO ! Need more people like you ;).

Problem

I have a small problem by using PDO instead of `mysql_fetch_object`. I tried to find something to replace it but nothing seems to work. First my link is done : ``` $link = new PDO('mysql:host='.$local.';dbname='.$nomBase.'', $user, $password, $pdo_options); ``` Here is my code : ``` while($row = mysql_fetch_object($result)){ $data1=$row->nickname; $data2=$row->id_contact; echo ("<option "); if ($handled==$data2) { echo ("selected "); } ``` Thanks for your help

Original source