The function named query()
returns an array of row where each element in that array is another associative array that forms a row.
When the following statement is executed, considering that username is a primary key,
query("SELECT * FROM users WHERE username = ?", $_POST["username"]);
and if there's a matching row in the database, query()
should return something like
Array
(
[0] => Array
(
[username] => kareem
[name] => Google Inc.
[symbol] => GOOG
[shares] => 1
)
)
The contents of the inner associated array may differ depending on the columns of your row(s) in your database.
You may use the function named dump()
to print the value that query()
returns.