View Full Version : Tables in PHP (+MySQL)

07-08-2005, 12:44 PM

I'm new to php and mysql and i have a problem.
I searched a tutorial about a news system which works fine.

Now i have this php file (index.php):

$result = mysql_query("SELECT * FROM news ORDER BY newsid DESC",$connect);
while($myrow = mysql_fetch_assoc($result))
echo $myrow['title'];
echo $myrow['dtime'];
echo $myrow['text1'];
echo "<br><a href=\"read_more.php?newsid=$myrow[newsid]\">Read More...</a>
|| <a href=\"edit_news.php?newsid=$myrow[newsid]\">Edit</a>
|| <a href=\"delete_news.php?newsid=$myrow[newsid]\">Delete</a><br><hr>";
This php file makes a loop to get all the news there is in the sql table but i want it to insert in a table this one:

<table width="200" border="0" cellspacing="0" cellpadding="0">
<tr bgcolor="#FFFFFF">
<td width="10" height="20">&nbsp;</td>
<td width="20" height="20"><div align="center"></div></td>
<td width="100"><div align="left"></div></td>
<td width="60"><div align="right"></div></td>
<td width="10" height="20">&nbsp;</td>
<tr bgcolor="#FFFFFF">
<td width="10" height="20">&nbsp;</td>
<td height="20" colspan="3">&nbsp;</td>
<td width="10" height="20">&nbsp;</td>

i wanted this:

the title in the first row of the table (120 width)
the date/time in the first row of the table (60 width)
the text and readmore/edit/delete in the second row of the table

I tried to take that in the table but it didn't work, can anyone pls help me with this. Thank you

07-09-2005, 04:23 PM
nvm got it