Using an html FORM
let's convert $core
in 100
and $mhz
in 1000
emag
and koyos
are table rows
So if $core
is set $parameters['emag'] = "$core";
is emag=100
else it is null
AND
and WHERE
are dinamically setted to appear, so the problem is that I collect all data of variables in $parameters[]
and foreach()
them.
With my code I am get exactly what $core
is. This is the code:
if (!empty($core)) {
$parameters['emag'] = "$core";
}
if (!empty($mhz)) {
$parameters['koyos'] = $mhz;
}
$sql = "SELECT * FROM $tbl_name WHERE 1=1 ";
if (!empty($parameters)) {
foreach ($parameters as $k => $v) {
$sql .= " AND " . $k . "='" . $v . "'";
}
}
$sql .= " ORDER BY emag, performanta_cpu_core DESC, performanta_cpu DESC LIMIT $start, $limit";
And it is results just rows with emag=100
, but I have need all numbers equals or little than 100
not just 100