views:

9

answers:

1

I have a table in my database called gsm_tariff. basically i just want to run a simple select query "SELECT * FROM {gsm_tariff} WHERE Country='Afghanistan' and store the results in an array. Can anyone help me with how to do this please. I know where to put the code and everything I just need the code to do the query and store the results in an array. Thanks

A: 
$array = array();

$result = db_query('SELECT * FROM {gsm_tariff} WHERE Country = "%s"', 'Afghanistan');

while ($record = db_fetch_object($result)) {
   $array[] = $record->(data to reference);   
}

Note that I don't know the field you want to reference given the question, but it would be in the $record object.

Kevin

related questions