
October 27th, 2004, 06:51 PM
|
|
Registered User
|
|
Join Date: Oct 2004
Posts: 2
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
Showing Database in tables
Hi, I am fairly new to MySQL and need some help.
I have created the database, the input form and the insert process. I just need help on the displaying part of it. As you can see http://www.pixeldimension.viperhosting.net/view.php there it ll comes up ok. The only thing i want changed is that the data is all in one table. On my current table it creates a new table for every entry.
PHP Code:
<? $username="(username)"; $password="(password)"; $database="(database)"; mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $query="SELECT * FROM contacts"; $result=mysql_query($query); $num=mysql_numrows($result); mysql_close(); echo "<b><center>Contacts</center></b><br><br>"; $i=0; while ($i < $num) { $name=mysql_result($result,$i,"name"); $age=mysql_result($result,$i,"age"); $website=mysql_result($result,$i,"website"); $email=mysql_result($result,$i,"email"); $msn=mysql_result($result,$i,"msn"); $ip=mysql_result($result,$i,"ip"); echo "<table border=\"1\" bordercolor=\"#000000\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">"; echo "<tr><td>Name</td> <td>Age</td> <td>Website</td> <td>Email</td> <td>MSN</td> <td>IP</td> </tr> <tr> <td>$name</td> <td>$age</td> <td>$website</td> <td>$email</td> <td>$msn</td> <td>$ip</td> </tr> "; echo "</table>"; $i++; } ?>
If anyone knows how i can do this please reply...that would be great.
Thanks
- Deshi
|