Код:
if (!empty($_GET['token']) & isset($_GET['token']))
{
$token_user = $dbh->quote($_GET['token']);
echo $token_user;
$stmt = $dbh->query("SELECT COUNT(*) as count from registr WHERE token = $token_user");
$query->setFetchMode(PDO::FETCH_ASSOC);
$row = $query->fetch();
if ($row['count'] == 1) {
}
}
И начало другого файла:
if (isset($_POST['reg'])) {
// проверка, есть ли такой логин в БД
function bd($what, $per)
{
global $dbh;
$query = $dbh->query("SELECT COUNT(*) as count FROM registr WHERE $what = '$per'");
$query->setFetchMode(PDO::FETCH_ASSOC);
$row = $query->fetch();
$members = $row['count'];
return $members;
}