kevinritt Posted October 16, 2006 Share Posted October 16, 2006 Hi,I recently received some great help from these forums on how to enter homework on a school's website. I tried displaying the data on a webpage in a table but it does not work. Can anyone point me to a tutorial or show me how to display a table using php? ;D Quote Link to comment Share on other sites More sharing options...
dymon Posted October 16, 2006 Share Posted October 16, 2006 <? /*DB Connection*/ /*DB Query & Result*/?><table border="0"> <?whilt $row=mysql_fetch_array($query_result) { print "<tr>"; print "<td>".$row['field_name']."</td>"; print "<td>".$row['field_name2']."</td>"; print "<td>".$row['field_name3']."</td>"; ..................................................... print "<tr>";</table> Quote Link to comment Share on other sites More sharing options...
kevinritt Posted October 16, 2006 Author Share Posted October 16, 2006 [quote author=dymon link=topic=111636.msg452528#msg452528 date=1160998355]<? /*DB Connection*/ /*DB Query & Result*/?><table border="0"> <?whilt $row=mysql_fetch_array($query_result) { print "<tr>"; print "<td>".$row['field_name']."</td>"; print "<td>".$row['field_name2']."</td>"; print "<td>".$row['field_name3']."</td>"; ..................................................... print "<tr>";</table>[/quote]Is there a closing ?> missingalso I am only pulling the latest entry from the database so I would not need the fetch_array. Is that correct? I am using the SELECT LAST_INSERT_ID(); Quote Link to comment Share on other sites More sharing options...
dymon Posted October 16, 2006 Share Posted October 16, 2006 Yes there should be ?> after print ...;If you want to extract the last entry, you can use:[code] mysql_query("SET NOCOUNT ON", $conn); $result = mysql_query("SELECT @"."@IDENTITY AS Ident", $conn); $row = mysql_fetch_row($result);[/code]This code worked for me, and in the $row are all the fields and values for the last entry. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.