Skip to main content
added 125 characters in body
Source Link
kzidane
  • 17.7k
  • 3
  • 28
  • 100

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
        (
            [id][username] => 10kareem
            [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.

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
        (
            [id] => 10
            [name] => Google Inc.
            [symbol] => GOOG
            [shares] => 1
        )
)

You may use the function named dump() to print the value that query() returns.

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.

Source Link
kzidane
  • 17.7k
  • 3
  • 28
  • 100

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
        (
            [id] => 10
            [name] => Google Inc.
            [symbol] => GOOG
            [shares] => 1
        )
)

You may use the function named dump() to print the value that query() returns.