hi

hope this helps

Peter



<?php
//load page contents into a variable then write to file

$retval.='      <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>';

$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))
{
$retval.="&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"%s\"><img src=\"%s\"
border=\"0\"></a><br>&nbsp;&nbsp;- <a
href=\"%s\">%s</a><br><br>",$a["url"],$a["picurl"],$a["picurl"],$a["title"])
";
}

$retval.='        </font></p>
            </td>
          </tr>
        </table>
      </div>';


//open file for writing
$myfile=fopen("review.htm","w+");

//write $retval to file
fputs($myfile,$retval);




?>



-----------------------------------------------
Excellence in internet and open source software
-----------------------------------------------
Sunmaia
www.sunmaia.net
[EMAIL PROTECTED]
tel. 0121-242-1473
-----------------------------------------------

> -----Original Message-----
> From: Alex Behrens [mailto:[EMAIL PROTECTED]]
> Sent: 01 April 2002 02:37
> To: [EMAIL PROTECTED]
> Subject: output to a file
>
>
> Hey Guys,
>
> I know this is more of a PHP question, but since most people here
> now a lot
> about PHP I thought I'd ask. I have a script that outputs headlines for
> reviews and I need to output it to a file for inserting into my page,
> because I can't use php on this specific page so I want to output it to
> html. how do I do this? I know you use the fopen, fputs and fclose php
> commands but dont know how to format it, below is my syntax:
>
>       <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 ("&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"%s\"><img src=\"%s\"
> border=\"0\"></a><br>&nbsp;&nbsp;- <a
> href=\"%s\">%s</a><br><br>",$a["url"],$a["picurl"],$a["picurl"],$a
> ["title"])
> ;
> }
> ?>
>         </font></p>
>             </td>
>           </tr>
>         </table>
>       </div>
>
> Thanks!
> --------------------------------------------
> -Alex "Big Al" Behrens
> E-mail: [EMAIL PROTECTED]
> Urgent E-mail: [EMAIL PROTECTED] (Please be brief!)
> Phone: 651-482-8779
> Cell: 651-329-4187
> Fax: 651-482-1391
> ICQ: 3969599
> Owner of the 3D-Unlimited Network:
> http://www.3d-unlimited.com
> Send News:
> [EMAIL PROTECTED]
>
>
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail
> <[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to