pdo statement to return more than 1 column in php -


i trying fetch values mysql query using pdo...it works 1 column need return 2 columns query. below piece of code have made...

try {       $conn = new pdo('mysql:host=localhost;dbname=****', 'root', '****'>setattribute(pdo::attr_errmode, pdo::errmode_exception);     } catch(pdoexception $e) {       echo 'error: ' . $e->getmessage();     }     $sth = $conn->prepare("select  distinct prod_url,ean tab_nl ean in (select ean1 test_sku sku='$sku') , prod_url '%prijzen%'"); $sth->execute();  $urlsku = $sth->fetchall(pdo::fetch_column, 0); $urlean = $sth->fetchall(pdo::fetch_column, 1); echo $sku; echo $urlsku; echo $urlean; 

it returns me array values...which can't figure out. can please me this.

$data = $sth->fetchall(pdo::fetch_assoc); echo $data[0]['prod_url']; echo $data[0]['ean']; 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -