Answer the question
In order to leave comments, you need to log in
Count number of cells in db using PDO?
Good afternoon!
There is a table:
$_GET contains data that corresponds to the number in the "user_id" column.
The query structure starts like this:
if(!empty($_GET)) {
$id = intval($_GET['id']);
//здесь должен быть запрос PDO в БД
}
Answer the question
In order to leave comments, you need to log in
$st = $pdo->prepare('SELECT COUNT(user_id) as cnt FROM `article` WHERE user_id=:user_id');
$st->bindParam(':user_id', $id, PDO::PARAM_INT);
$art_column = $st->fetch();
$st->execute();
$data = $st->fetch();
echo $data['cnt']; // выводим количество
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question