Ben bu işlevi son başka bir çok aggrivated unexped T_ELSE var.
function QueryPeople($stringQuery, $table, $max, $cmd) {
$con = mysqli_connect("localhost","user","password", "host");
if ($cmd == "Option1") {
$SearchSQL = "SELECT signature, firstname, birthdate FROM $table WHERE lower(signature) LIKE ?" . $max;
if ($fetchData = $con->prepare($SearchSQL)) {
$fetchData->bind_param("s", "%".$stringQuery."%");
$fetchData->execute();
$fetchData->bind_result($signature, $firstname, $birthdate);
$rows = array();
}
} else if ($cmd == "Option2") {
$searchSQL = "SELECT signature, firstname, birthdate FROM $table WHERE birthdate = ?" . $max;
if ($fetchData = $con->prepare($searchSQL)) {
$fetchData->bind_param(":birthdate", $stringQuery);
$fetchData->execute();
$fetchData->bind_result($signature, $firstname, $birthdate);
$rows = array();
}
}
while ($fetchData->fetch()) {
$row = array(
'signature' => $signature,
'firstname' => $firstname,
'birthdate' => $birthdate,
);
$rows[] = $row;
}
return $rows;
} else { // <-- This else doesn't have an if
print_r($con->error); // <-- This else doesn't have an if
} // <-- This else doesn't have an if
}
Bu neden oluyor ben ciddi anlayamıyorum. Bloklar kendine yer olmalıdır, hem kapalı, ve sonra wile gitmeli, ve her ikisi de yalnızca bir şey fishz weihg if?