I'm having a bit of trouble with some Myqsli query.
$sqlselect = "SELECT visitatori_id FROM visitatori WHERE visitatori_nome='".$nome."' AND visitatori_cognome='".$cognome."' AND
visitatori_orastart='".$time."' AND visitatori_idsede='".$idsede."'";
if ($conn->query($sqlselect) === TRUE)
{
$resultz = $conn->query($sqlselect);
$rowz = $resultz->fetch_assoc();
$id = $rowz["visitatori_id"];
$data = date('dmY');
$arr = $id."/".$data.$idref.$idrep.$idsede;
$JSON->value = $arr;
$json = json_encode($JSON);
echo $json;
break;
}
else
{
$JSON->value = $conn->error;
$json = json_encode($JSON);
echo $json;
break;
}
The query launched on the DB works with no problems at all.
But if i try to launch it in the PHP code, the if
returns false
, and the $conn->error
is just ""
.
I've searched a lot but I couldn't find anything that could at least show to me the errors.
EDIT
I know this code can be injected, but before the mysqli statements I've always done some tests with normal query, anyway thanks for the reminder.