PHPize Online / SQLize Online

A A A
Share   Donate   Blog   Popular
Copy Format Clear
CREATE TABLE language ( code varchar(3), title varchar(64), base int, id int ); INSERT INTO language VALUES ('ru', 'Russian', 0, 1), ('en', 'English', 0, 2);
Copy
Copy Format Clear
<?php $result = $pdo->query( "SELECT code, title FROM language ORDER BY base DESC" ); $langs = $result->fetchAll(PDO::FETCH_COLUMN); var_export($langs); $langs = $result->fetchAll(PDO::FETCH_ASSOC); var_export($langs); $langs = array_combine($result->fetchAll(PDO::FETCH_COLUMN), $result->fetchAll(PDO::FETCH_ASSOC)); var_export($langs);
Show:  
Copy