A
A
adrenalinruslan2018-03-02 21:54:00
PHP
adrenalinruslan, 2018-03-02 21:54:00

Always writes that there is no such record?

Help please, I use PDO mysql and send a query to the database. If such an entry is found, it will display what was found, if not, it will display what was not found. But nothing works! How to fix ?

$query = $link->query("SELECT * FROM `BetGamesOne` WHERE `tirazh` = '$tirazh'");
$row = $query->rowCount();
if($row > 0) 
{
  echo "Найдено!";
}
else {
  echo "Не найдено!";
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ilya Kanyshev, 2018-03-02
@ikanyshev

If $tirazh is a variable then

$query = $link->query("SELECT * FROM `BetGamesOne` WHERE `tirazh` = '"+$tirazh+"'");
$row = $query->rowCount();
if($row > 0) 
{
  echo "Найдено!";
}
else {
  echo "Не найдено!";
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question