This is how I presently fetch from the DB:
if ($stmt = $mysqli->prepare ( "SELECT fname,lname from $table_name
where cno >=? LIMIT 50" ))
{
$stmt->bind_param ( "i", $cno);
$stmt->execute ();
$stmt->bind_result ($fname,$lname);
$arrayUsers = array();
while ($stmt->fetch())
{
if (isset ($fname))
{
$arrayUsers[] = array(
"fname" => $fname,
"lname" => $lname);
}
}
$stmt->close ();
}
$mysqli->close ();
and it works great.
But if I change my select to SELECT * from
... my bindings fail.
Does that mean if I have a large number of fields, I will still have to specify each and every field or is there a way to use select *
?
---- updated ---
if (empty($arrayUsers))
{
return 0;
}
else
{
return $array;
}