← All built-ins / mysql_query()

mysql_query()

mysql_query(...$args): mixed

Parameters

NameTypeDescription
$connresourcehandle from mysql_connect()
$sqlstringSELECT/SHOW statement

Return value

Rows as array of maps (column name => value), false on error.

Example

echo "rows = mysql_query($c, "SELECT id, name FROM users");";
rows = mysql_query($c, "SELECT id, name FROM users");

This call needs a real environment (window, server, database or stdin) — the snippet above shows the typical usage shape.

See also

mysql_connect()mysql_exec()mysql_insert_id()