Forum Moderators: coopster
$con is defined previously in the file and works for all other queries, so that's not the issue. The function is not returning any mysqli_errors, so that's not the issue either. Also, the query $q works when entered directly into MySQL. Therefore, the problem lies somewhere in the PHP logic. function nameTheStaff($x) {
$q="SELECT * FROM staff WHERE staff_id='$x'";
$result=mysqli_query($con,$q);
while($r=mysqli_fetch_array($result)) {
$staff=$r['first_name'].' '.$r['last_name'];
}
if (mysqli_errno()) { return mysqli_error(); }
else { return $staff; }
}
}