dimanche 23 octobre 2016

How PDO function results

function p2a($query, $connection, $debug=0){ //Gelen arrayı, belirtilen tabloya kaydeder
    if($debug==1) echo "<div class='alert alert-info alert-dismissable'>$query</div>";
    $result=$connection->query($query);
    @(int)$count=$result->rowCount();
    if($count>0){
        return $result->fetchAll(); 
        }else{
            return array();
            }   
    }



$ozer=p2a(query,$db);

if($ozer){
echo "ok";
}else{
echo mysql_error();
}

You can see at the bottom

if query

How do I run the PDO

How should I edit function

thanks

Aucun commentaire:

Enregistrer un commentaire