How can you make an array of database records, where, for example, there is only the age value - 14?
1 answer
Perform a query in accordance with your database:
$sql="select zapis from table1 where vozrast=14";
And then you 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 a variable received after calling mysql_query ()
The $ type parameter describes the format of the returned data. It 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, etc. (fields are considered "from left to right" in the order in which they were declared in the request)
|