Reply to Re: Little Problem with my Guestbook

Your name:

Reply:


Posted by David Robley on 09/14/05 09:44

Florian Paucke wrote:

> Hi.
>
> I'm new to PHP.
>
> I need some help from you, because, I'm creating a
> guestbook. But I have a little problem.
>
> I have a table, where the different My-SQL-Entries
> are read out.
> But now I get only one Entry, but not more.
>
> How can do it, that the table read out 4 times, when
> 4 entries are in the database?
>
> And the cursor from the database are jumping to
> the next entry.
>
> Sorry for my bad english. :)

Assuming you are using a SELECT statement that returns more than one row,
you need to loop through the rows that are returned by your query. Have a
look at the examples for mysql_fetch_array in the php docs at
php.net/mysql_fetch_array The examples show the entire process from the
SELECT statement through to printing the results with printf.

You may find printf a bit daunting; echo might be easier for a beginner
unless you are used to C. To use echo, in example 3 replace

printf("ID: %s Name: %s", $row["id"], $row["name"]);

with

echo "ID: {$row["id"]} Name: {$row["name"]}";

Cheers
--
David Robley

I Never Knew A Cat Who Suffered From Insomnia.

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

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