StuartBombay
Programmer
I can't figure out why the array count shows 1. If I copy the resulting SQL into the MySQL database I get 2 rows of results, but php is returning a count of 1. More puzzling is the while loop returns 2 names.
I'm obviously not understanding something here!
The results are-
SELECT fullname, locnum from v_program_details where prognum = '2254'
1
Rose Heights
Rose Heights
I need to know when I'm getting more than one record returned! I can put a count in the while loop, that works - but I think the count() should work too!
Thanks --
I'm obviously not understanding something here!
Code:
$get_name_sql = "SELECT fullname, locnum from v_program_details where prognum = '".$_POST["sel_id"]."'";
$get_name_rs = mysqli_query($conn, $get_name_sql)
or die(mysqli_error($conn));
print $get_name_sql; echo "<br/>";
$prog_count = count($get_name_rs);
print $prog_count;
while ($name_info = mysqli_fetch_array($get_name_rs)) {;
$display_name = stripslashes($name_info['fullname']);
$locnum = stripslashes($name_info['locnum']);
echo "<br/>"; print $display_name;
}
The results are-
SELECT fullname, locnum from v_program_details where prognum = '2254'
1
Rose Heights
Rose Heights
I need to know when I'm getting more than one record returned! I can put a count in the while loop, that works - but I think the count() should work too!
Thanks --