FW: [PHP-DB] need some help...
| From: | Peter Lovatt | Date: | Wed, 03 Apr 2002 00:52:34 +0000 |
| Subject: | FW: [PHP-DB] need some help... | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-18140@lists.php.net to get a copy of this message | ||
hi Alex
basically you load a variable with the contents of the page, and then write
the contents of the variable to the file
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.=" <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"])
";
}
$retval.=' </font></p>
</td>
</tr>
</table>
</div>';
//open file for writing
$myfile=fopen("review.shtml","w+");
//write $retval to file
fputs($myfile,$retval);
?>
-----------------------------------------------
Excellence in internet and open source software
-----------------------------------------------
Sunmaia
www.sunmaia.net
info@sunmaia.net
tel. 0121-242-1473
-----------------------------------------------
> -----Original Message-----
> From: Alex Behrens [mailto:bigal@3d-unlimited.com]
> Sent: 03 April 2002 01:25
> To: php-db@lists.php.net
> Subject: [PHP-DB] need some help...
>
>
> Hey Guys,
>
> I'm new to this list and I need some help outputing some code to
> a .shtml file instead of using a dynamic php file. Can someoneh
> elp me get this working?
>
> 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 (" <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>
>
>
> Thanks!
> --------------------------------------------
> -Alex "Big Al" Behrens
> E-mail: bigal@3d-unlimited.com
> Urgent E-mail: bigal-cell@3d-unlimited.com (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:
> news@3d-unlimited.com
>