D
D
Dmitry2014-05-24 18:15:03
PHP
Dmitry, 2014-05-24 18:15:03

Why does the query return only one result?

Request:

$times= $sql->query("SELECT * FROM datetime WHERE date='2014-05-24'")->fetch_array();

date in the database is of type "date".
The "datetime" table has 2 rows with the same date column value. The script returns only one result (the one with the larger id). What could be the problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
andreyqin, 2014-05-24
@another_dream

$result = $sql->query("SELECT * FROM datetime WHERE date='2014-05-24'");
while ($row = $result->fetch_assoc()) {
    $times[] = $row;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question