How to make an array of values ​​in the database in PHP, MySql?

How can I make an array of database records, where, for example, there is only the age value – 14?


Answer 1, authority 100%

Run a query according to your database:

$sql="select zapis from table1 where vozrast=14";

And then process:

$result=mysql_query($sql)or die("Query failed: " . mysql_error());   
     while ($row = mysql_fetch_array($result, MYSQL_NUM)) 
    {    
        printf ("ID: %s  Name: %s", $row[0], $row[1]);  
    }

mysql_fetch_array($result, $type)

$result is the variable returned after calling mysql_query()

The $type parameter describes the format of the returned data. Can take one of three values:

MYSQL_NUM. The function returns a numbered array, where the zero element is the value of the zero field, the first element is the value of the first field, and so on. (fields are considered “left to right” in the order in which they were declared in the request)