[PHP] Little Problem with my Guestbook

2005-09-14 Thread Florian Paucke
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. :)

MFG

Florian Paucke

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Little Problem with my Guestbook

2005-09-14 Thread Jasper Bryant-Greene

Florian Paucke wrote:

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


Please provide the code that is causing problems so that we can 
understand your problem and help you fix it.


--
Jasper Bryant-Greene
Freelance web developer
http://jasper.bryant-greene.name/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Little Problem with my Guestbook

2005-09-14 Thread Florian P.
?php

include(sql.inc.php);
include(config.inc.php);

$connection = mysql_connect($sql['host'],$sql['uid'],$sql['pwd']);
$select_db = mysql_select_db($sql['db']);

$select = mysql_query('SELECT * FROM comments');
$data = mysql_fetch_array($select);

$result = mysql_query('SELECT * FROM comments');
$rows = mysql_num_rows($result);

?

?php

echo  Gauml;stebucheintrauml;ge gesamt: $rows;

?

table border=1 width=95%
tr
td
ID:
/td
td
?php echo $data[id]; ?
/td
/tr
tr
td
Name:
/td
td
?php echo $data[autor]; ?
/td
/tr
tr
td
Titel:
/td
td
?php echo $data[titel]; ?
/td
/tr
tr
td
Kommentar:
/td
td
pre?php echo $data[comment]; ?/pre
/td
/tr
/table



Thats the code i have written.

And I would like to post the table/table how often
I have SQL-entries in my database.

I hope you understand what I would like to say.

And in each cycle it ought to put out the next entry of the database.



Florian P.







Jasper Bryant-Greene [EMAIL PROTECTED] schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
 Florian Paucke wrote:
  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. :)

 Please provide the code that is causing problems so that we can
 understand your problem and help you fix it.

 --
 Jasper Bryant-Greene
 Freelance web developer
 http://jasper.bryant-greene.name/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Little Problem with my Guestbook

2005-09-14 Thread John Nichel

Florian P. wrote:

?php

include(sql.inc.php);
include(config.inc.php);

$connection = mysql_connect($sql['host'],$sql['uid'],$sql['pwd']);
$select_db = mysql_select_db($sql['db']);

$select = mysql_query('SELECT * FROM comments');
$data = mysql_fetch_array($select);

$result = mysql_query('SELECT * FROM comments');
$rows = mysql_num_rows($result);

snip

No reason to run this twice

$data = array();
if ( $result = mysql_query ( 'SELECT * FROM comments' ) ) {
while ( $temp = mysql_fetch_array ( $result, MYSQL_ASSOC ) ) {
$data[] = $temp;
}
$rows = mysql_num_rows ( $result );
mysql_free_result ( $result );
} else {
echo ( mysql_error() );
exit;
}

The returned rows will be in the $data array.

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php