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

Posted by J.O. Aho on 02/01/06 18:28

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

This is more a question for alt.php.sql, so added it.


> 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...

you can use LIMIT for this in your SQL statement, but to know how many pages
links to setup you still need to know the total number of pages, so you need
to make a

SELECT COUNT(*) FROM personal where l_name ='$_POST[l_name]'



//Aho

 

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

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