PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      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 Clear
Copy Format Clear
<?php $result = $pdo->query( "SELECT code, title, base, id FROM language ORDER BY base DESC", PDO::FETCH_ASSOC ); $langs = $result->fetchAll(); $langs = array_combine(array_column($langs, 'code'), $langs); var_export($langs);
Show:  
Copy Clear