Not really a database question, but why not... Step 1: Clean up the code... a) Convert all double-quote to single quotes in the HTML portion. I usually use doubles for PHP and singles for HTML. I hate having to escape quotes. b) Use of spacing and indentation.
old ********************************************** <div align="left"> <table border="0" cellpadding="0" cellspacing="0" width="95%"> <tr> <td width="100%"><p> <font face="Tahoma, Verdana, Arial, Helvetica" size="1"><img src="/images/menu-reviews.gif" width="137" height="20"><br><br><?php $db = mysql_connect( "db", "******", "******"); mysql_select_db( "net3dual_reviews",$db); $r = mysql_query("SELECT * FROM hwureviews ORDER BY num DESC LIMIT 7"); $max = mysql_query("select max(num) from hwureviews",$db); while($a=mysql_fetch_array($r)) { printf (" <a href=\"%s\"><img src=\"%s\" border=\"0\"></a><br> - <a href=\"%s\">%s</a><br><br>",$a["url"],$a["picurl"],$a["picurl"],$a["title"]) ; } ?> </font></p> </td> </tr> </table> </div> ********************************************** new ********************************************** <div align='left'> <table border='0' cellpadding='0' cellspacing='0' width='95%'> <tr> <td width='100%'><p> <font face='Tahoma, Verdana, Arial, Helvetica' size='1'> <img src='/images/menu-reviews.gif' width='137' height='20'><br><br> <?php $db = mysql_connect( "'db", "******", "******"); mysql_select_db( "net3dual_reviews",$db); $r = mysql_query("SELECT * FROM hwureviews ORDER BY num DESC LIMIT 7"); $max = mysql_query("select max(num) from hwureviews",$db); while($a=mysql_fetch_array($r)) { printf (" <a href=\"%s\"><img src=\"%s\" border='0'></a><br> - <a href='%s'>%s</a><br><br>",$a["url"],$a["picurl"],$a["picurl"],$a["title"]); } ?> </font></p> </td> </tr> </table> </div> ********************************************** Since you have to put a string value, assign all output to a single string called $output. Note that I moved your printf() to an echo, and simplified your output string by preassigning variables. An extra step, but greatly enhances readability and maintenance... Also remember that the ".=" is an append operator whereas "=" is assignment. even newer ********************************************** // Assign the stuff before... $output = " <div align='left'> <table border='0' cellpadding='0' cellspacing='0' width='95%'> <tr> <td width='100%'><p> <font face='Tahoma, Verdana, Arial, Helvetica' size='1'> <img src='/images/menu-reviews.gif' width='137' height='20'><br><br> "; <?php $db = mysql_connect( "'db", "******", "******"); mysql_select_db( "net3dual_reviews",$db); $r = mysql_query("SELECT * FROM hwureviews ORDER BY num DESC LIMIT 7"); $max = mysql_query("select max(num) from hwureviews",$db); while($a=mysql_fetch_array($r)) { $url = $a["url"]; $picurl = $a["picurl"]; $title = $a["title"]; // add in each link to the review $output .= " <a href='$url'> <img src='$picurl' border='0'> </a> <br> - <a href='$picurl'> $title </a> <br><br>"; } ?> // finish the structure HTML $output .= " </font></p> </td> </tr> </table> </div> "; // Now fopen() the file, fputs the $output, and fclose() the file. ********************************************** http://www.php.net/manual/en/function.fopen.php http://www.php.net/manual/en/function.fputs.php http://www.php.net/manual/en/function.fclose.php Party on! -Szii -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php