Hi! Could we please enable some services and cookies to improve your experience and our website?

PHPize Online / SQLize Online  /  SQLtest Online

A A A
Login    Share code      Blog   FAQ

Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code

Copy Format Clear
CREATE TABLE city ( id int primary key, name varchar(64) ); INSERT INTO city VALUES (1, 'Moscow'), (2, 'St. Pitersburg');

Stuck with a problem? Got Error? Ask AI support!

Copy Clear
Copy Format Clear
<?php $connect = &$mysqli; $citys = mysqli_query($connect, "SELECT * FROM `city`"); $citys = mysqli_fetch_all($citys); echo '<select name="magaz">' . PHP_EOL; foreach ($citys as $city) { echo '<option value=' . $city[0] . '>' . $city[1] . '</option>' . PHP_EOL; } echo '</select>' . PHP_EOL;
Copy Clear