![]() |
|
#1
|
|||
|
|||
Php And Table FormattingELLO
i have just started using php and am having some difficulties with regard to getting the db results to view in a table the code being used ommitting passwords is:- <html> <head> <title>test</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> </head> <body> <?php $username = "pellsweb1"; $password = "******"; $hostname = "localhost"; $dbh = mysql_connect($hostname, $username, $password) or die("unable to connect to MYSQL") ; print "Connected to mysql<br>"; $selected = mysql_select_db("pellsweb",$dbh) or die("could not select phil".mysql_error()); $res = mysql_query("SELECT * FROM phil") or die (mysql_error()); ?> <table width="530"> <tr> <td width="136" height="90"><div align="center">id</div></td> <td width="136"><div align="center">firstname</div></td> <td width="136"><div align="center">surname</div></td> <td width="136"><div align="center">addy</div></td> </tr></table> <?php while ($row = mysql_fetch_array($res,MYSQL_ASSOC)) { print "<tr><td>" . $row['id'] . "</td><td>" . $row['firstname'] . "</td><td>" . $row['surname'] . "</td><td>" . $row['addy']."</td></tr><br>"; } // you are going to do lots more here soon mysql_close($dbh); ?> </table> </body> </html> and the web page showing the output is @ www.pellsweb.co.uk i know that some thing is wrong here but cant see what the hell it is, as you can see from the web page there is no error being reported so (holds hands up in despair). any help would be greatly appreciated. thanks in advance. Last edited by dsmith : 09-Feb-2004 at 22:00.
|
|
#2
|
||||
|
||||
|
Hey, sorry if this doesn't help. I don't know a heck of alot about php right now, but i do know a little about html. It appears that you end your table definition before you add your records, try removing the end table that you have here:
HTML Code:
so it looks like this: HTML Code:
Hope that helps |
|
#3
|
|||
|
|||
php and table formattingthanks mate did the trick i didnt realise that i ended the table 2 times well spotted
|
Recent GIDBlog
First week of IA training by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| PHP script to show last referrer url and top referrer to your site | jrobbio | MySQL / PHP Forum | 6 | 22-May-2006 01:06 |
| Textarea and PHP. | Antinaris | MySQL / PHP Forum | 2 | 21-Nov-2003 09:09 |
| Trying to retrieve selective results from a table. | icsys | MySQL / PHP Forum | 9 | 18-Nov-2003 03:31 |
| Automate a data change php form | mjfmn | MySQL / PHP Forum | 4 | 20-Oct-2003 09:37 |
| [Tutorial] MySQL Basics | nniehoff | MySQL / PHP Forum | 15 | 23-Mar-2003 19:42 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The