I have an existing database which has a table called PERSON with a field called NAME. What I’m trying to do is select all of the rows in the table where the NAME is "bill". And then I want the result to be stored in an array that I can step through at a later point.
Now, the problem is my code will only select the FIRST row with the name "bill" and ignore the rest of the rows where the NAME is "bill". At least that’s how it appears when I print out the array contents with print_r(). My code below:
<?php
$getAllPreview = "SELECT * from PERSON where NAME = 'bill'";
$getAllResult = @mysql_query( $getAllPreview );
$getAllRows = @mysql_fetch_assoc( $getAllResult );
print "<pre>";
print_r($getAllRows);
print "</pre>";
?>
while(), orforeach()@operator on StackOverflow if you explain why you are using it. Hiding notices, warnings and errors only makes it more difficult for us to help you.