J
J
jistulamle2018-03-04 15:04:35
PHP
jistulamle, 2018-03-04 15:04:35

Why doesn't the check for the existence of an N-string[PHP] work?

The class has a function

public function checkRow($query = null, $params = [])
    {
        $result = $this->link->prepare($query);
        $result->execute($params);
        return $result->fetchColumn();
    }

I call her like this
print_r($db->checkRow('SELECT count(proxy) FROM ' . Config::TABLE_SITE . ' WHERE proxy=' . '1.1.1.1:8080'));

but it does not display anything, it is when using this type of record 1.1.1.1:8080 , but if you just write 11118080 it shows 0 or 1 , depending on the presence in the database. How to fix?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Anton Shamanov, 2018-03-04
@jistulamle

proxy="1.1.1.1:8080"

V
Vladimir Skibin, 2018-03-04
@megafax

Check the data types you are using for the fields. For IPv4 use INT UNSIGNED and for INET_ATON and INET_NTOA conversion and keep the port separate.
And use appropriate quotes for tables/columns/values.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question