Web студия "GrandView"
  Главная   Написать Контакты
   
   
О проекте
Руководство php
 

mysql_fetch_row

(PHP 3, PHP 4, PHP 5)

mysql_fetch_row -- Орабатывает ряд результата запроса и возвращает неассоциативный массив.

Описание

array mysql_fetch_row ( resource result )

Возвращает массив, содержашей данные обработанного ряда, или FALSE, если рядов больше нет.

mysql_fetch_row() обрабатывает один ряд результата, на который ссылается переданный указатель. Ряд возвращается в массиве. Каждая колонка распологается в следующей ячейке массива. Массив начинается с индекса 0.

Последующие вызовы функции mysql_fetch_row() вернут следующие ряды или FALSE, если рядов не осталось.

Замечание: Имена полей, возвращаемые этой функцией, регистро-зависимы.

См. также mysql_fetch_array(), mysql_fetch_assoc(), mysql_fetch_object(), mysql_data_seek(), mysql_fetch_lengths() и mysql_result().



mysql_field_flags> <mysql_fetch_object
Last updated: Fri, 26 Jan 2007
 
add a note add a note User Contributed Notes
mysql_fetch_row
m dot s at programmers-online dot net
17-Nov-2005 01:56
The following function to read all data out of a mysql-resultset, is may be faster than Rafaels solution:

<?
function mysql_fetch_all($result) {
   while($row=mysql_fetch_array($result)) {
       $return[] = $row;
   }
   return $return;
}
?>
mysql at polyzing dot com
12-Jul-2003 03:05
It is probably worth pointing out that the array elements will actually be of type string, OR NULL if the field is null in the database.

Thus, either use a double equal comparison to look for empty or null

Or, use a triple equal comparison to be able to distinguish the two cases

e.g.

if ($field === '') echo "Empty, not NULL\n";

if ($field === NULL) echo "NULL\n";

if ($field == '') echo "Empty or NULL\n";
michael and then an at sign wassupy.com
08-Apr-2003 12:09
to print an array, simply use print_r(array name)

like this:
    $myrow = mysql_fetch_row($result);
echo "<pre>";
print_r($myrow);
echo "</pre>";

this will output the array in a readable form, with the index, too. Don't forget the 'pre' tags or the output will be on a single line.
a at simongrant dot org
06-Feb-2002 05:10
Maybe worth pointing out that all the fields returned by this (and other?) calls are returned with type string. This had me puzzled for quite some time.
php dot net at sury dot cz
06-Jun-2001 11:40
You could also use this language construct with mysql_fetch_row:

while (list($first, $second) = mysql_fetch_row($resource)) {
[...]
}
doug at melonn dot com
13-May-2001 01:57
you can also use mysql_fetch_row() like this if you want to display inumerable results the same way:

#connect to the server and select db
mysql_connect("host","username","pass");
mysql_select_db("dbname");

#query the db
$query = "SELECT * FROM table";
$result = mysql_query($query)
or die(mysql_error());

#display results
while($i = mysql_fetch_row($result)) {
echo $i[0];
echo $i[1];
.....
}

and so forth...

mysql_field_flags> <mysql_fetch_object
Last updated: Fri, 26 Jan 2007
 
 
Новости
11 июля 2007
Сайт запущен
© 2007 info@grandviewstudio.com

Deprecated: Function set_magic_quotes_runtime() is deprecated in /home/sites/grandviewstudiocom/www/65f67d67a94ad980786580ae69e11c07/sape.php on line 324

Deprecated: Function set_magic_quotes_runtime() is deprecated in /home/sites/grandviewstudiocom/www/65f67d67a94ad980786580ae69e11c07/sape.php on line 330
Z058440144362 Z348613067571