Numbers in guestbook
Moderator: General Moderators
Numbers in guestbook
Hi!
Im a newbe in php and want some help.
I want to print a number for each guestbook contribution
The guestbook use a mySQL.
example:
3 persons have write something in my guestbook
and i want to print
Number: 1
Number: 2
Number: 3
Not the entire guestbook, just the number of each contribution
Thanx
----------------------
excuse my english spelling
Im a newbe in php and want some help.
I want to print a number for each guestbook contribution
The guestbook use a mySQL.
example:
3 persons have write something in my guestbook
and i want to print
Number: 1
Number: 2
Number: 3
Not the entire guestbook, just the number of each contribution
Thanx
----------------------
excuse my english spelling
- Buddha443556
- Forum Regular
- Posts: 873
- Joined: Fri Mar 19, 2004 1:51 pm
-
d3ad1ysp0rk
- Forum Donator
- Posts: 1661
- Joined: Mon Oct 20, 2003 8:31 pm
- Location: Maine, USA
Code: Select all
//connect to database and select DB
$sql = "SELECT * FROM table";
$result = mysql_query($sql);
while($row = mysql_fetch_array($result)){
echo "Number: " . $row['id'];
}- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
fixed a little missing element for debugging...LiLpunkSkateR wrote:Code: Select all
//connect to database and select DB $sql = "SELECT * FROM table"; $result = mysql_query($sql) or die(mysql_error()); while($row = mysql_fetch_array($result)){ echo "Number: " . $row['id']; }
Thx but this just echo the id number.
I want to echo the number for each post in my guestbook
example.
3 persons have sign my guestbook.
We then have 3 id in guestbook.
If i delete number 2, then the next person that sign my guestbook will get id 4, and this print number 4. But its just 3 posts in my guestbook
Get it ? =)
Dont know how to explain it, my english are not so good..
I want to echo the number for each post in my guestbook
example.
3 persons have sign my guestbook.
We then have 3 id in guestbook.
If i delete number 2, then the next person that sign my guestbook will get id 4, and this print number 4. But its just 3 posts in my guestbook
Get it ? =)
Dont know how to explain it, my english are not so good..
-
magicrobotmonkey
- Forum Regular
- Posts: 888
- Joined: Sun Mar 21, 2004 1:09 pm
- Location: Cambridge, MA
Code: Select all
<?php
$sql = "SELECT COUNT(*) FROM table";
$result = mysql_query($sql) or die(mysql_error());
$row = mysql_fetch_array($result))
echo "Number of signers: " . $row['0'];
?>Ok.
ehh let me se how to explain what i mean.
Visit the link below, and you will se what i mean.
http://www.olzzon.com/g/g.php?a=s&i=g10-01617-96
Look at "Nummer" on each post
ehh let me se how to explain what i mean.
Visit the link below, and you will se what i mean.
http://www.olzzon.com/g/g.php?a=s&i=g10-01617-96
Look at "Nummer" on each post
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
you didn't seem to read my post...
should do (almost) exactly what you said.. this isn't rocket science..
Code: Select all
//connect to database and select DB
$sql = "SELECT * FROM table";
$result = mysql_query($sql) or die(mysql_error());
while($row = mysql_fetch_array($result)){
echo "Number: " . $row['id'];
}