In a while loop, is there a way to make a certain story get written to a file first?
For instance, if I mark a record in the database as "centerpiece", I want it to be written to the top of the file.
Any ideas? Here is my code I am trying:
$fp = fopen ('../redesign/' . pubdate() . '/business/business_content.shtml', 'w');
// if a result is returned
if (mysql_num_rows($result) > 0)
{
// iterate through resultset
// print data
while (list($headline, $bodytext, $custom3, $photocredit, $caption, $pubdate, $section, $id, $web, $centerpiece) = mysql_fetch_row($result))
{
if($fp)
{
if(!isset($centerpiece)){
fwrite($fp,'<table width="160" border="0" cellspacing="5" cellpadding="0" align="right">
<tr>
<td bgcolor="#ffffff" width="1"><img src="/art/spacer.gif" width="1" height="1"></td>
<td width="7"><img src="/art/spacer.gif" width="1" height="1"></td>
<td class="phototext" width="130">');
etc
etc
etc