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
[Back to original message]
|