N
N
Nick Bukovskiy2017-04-21 13:09:36
PHP
Nick Bukovskiy, 2017-04-21 13:09:36

Does not retrieve data from the database. Where did I make a mistake in the request?

$dbh = new PDO('mysql:host=localhost;dbname=course_db; charset = utf8', 'root', ''); 
$sql = 'SELECT * FROM orders, orderdetails WHERE customerNumber="141" AND requiredDate < 2003-07-19 '; 
$request = $dbh->query($sql); 
foreach ($request as $p) { 
echo 'customerName: ' . $p['customerNumber'] . '</br>' . 'requiredDate: ' . $p['requiredDate'] . '</br>' . '<hr>'; 
}

I would be very happy to help, thank you very much

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Baranov, 2017-04-21
@andre-92

foreach ($request->fetchAll() as $p)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question