You are here: mysql_fetch_array « All PHP « IT news, forums, messages
mysql_fetch_array

Posted by Mike on 02/01/06 18:07

Basically what I want to do is display the results of a search from a
MySQL database.

I can get data into a array as follows...

$result = mysql_query("SELECT id, f_name, l_name FROM personal where
l_name ='$_POST[l_name]'");

while ($row = mysql_fetch_array($result, MYSQL_BOTH)) {
$id = $row["id"];
$f_name = $row["f_name"];
$lifelog = $row["l_name"];
echo "ID = $id First Name = $f_name Last Name = $l_name<br>";
}

This all works fine. But I need to control how many are displayed so I
can set up multiple pages and have links to page 2/3/4 etc...

I thought of a way to do it but I need to access each line of the array
by number. I think this is called the master element index position.

I thought the following would work but it dosn't...

$row = mysql_fetch_array($result, MYSQL_BOTH)
echo $row[1]['id'];
echo $row[1]['f_name'];
echo $row[1]['l_name'];

Theres no error, it just returns nothing.

Any ideas??

Thanks

Mike

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация