0
I am developing an application with PDO, and I normally use the bindValue()
to execute the SELECT
's, but I am developing an application that receives a variable that contains numbers and comma, which will later be exploded.
What I wanted to know is: That way it’s safe to avoid attacks, otherwise, how would these attacks be carried out?
$categories = '10,12,22,123,120'; # ESSES SÃO OS ID'S DAS CATEGORIAS DESEJADAS
$category = explode(',', $categories);
for ($i = 0; $i < count($category); $i++) {
if (is_numeric($category[$i]) {
$this->condition .= "categoryName = '{$category[$i]}'";
if ($i < count($category) - 1) {
$this->condition .= ' AND ';
}
}
}
What doesn’t make sense is to use a single column to store multiple values. The
is_numeric
allows giant numbers, larger than the maximum uint64, which can be a problem. Also, it allows float.– Inkeliz
In fact it is an auxiliary table to make a SELECT of many for many, the is_numeric serves to authenticate.
– Anderson Santos