fetch single record using PHP PDO and return result

后端 未结 2 1320
终归单人心
终归单人心 2021-01-29 12:05

how to fetch single row with all columns in custom php function and return result

here is my custom function code

function getdata($sql,$dbh)
 {

            


        
2条回答
  •  野的像风
    2021-01-29 13:07

    You are not executing your Query?!

    $dbh = new PDO("connection string"); 
    $get_row = $dbh->prepare($sql); 
    $get_row->execute(); 
    $row = $get_row->fetch();
    

    Try this for get Single Row of all column.

提交回复
热议问题