Quantcast
Channel: PHP Freaks: PHP Help
Viewing all articles
Browse latest Browse all 13200

mysql result into an array

$
0
0

im trying to get a MySQL result to be stored in a variable(array) so I can use the array later.

ive never had to do this before and the search's ive done don't seem to do what I need.

 

the end result im after is a members list. the array im tryin to build will be compared to another query and the other query will have the names removed so I don't echo the same name twice. my code works with a manual array but I want to build the array from a different table hence this query I carnt get working. 

$sql5 = "SELECT * FROM officer order by 'name' asc";
$result5=mysql_query($sql5) or die ( mysql_error () );

while($row5 = mysql_fetch_array( $result5 )) {

$test = array($row5['name']);

}
//
//the end result I want from the above query so I can use it later
$test = array("name1", "name2", "name3", "name4", "name5", "name6");

Viewing all articles
Browse latest Browse all 13200

Trending Articles