php code to save to multiple html from qurery string

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
yoru_san
Forum Newbie
Posts: 2
Joined: Wed Apr 23, 2008 4:57 am

php code to save to multiple html from qurery string

Post by yoru_san »

i want to save separate page of html file as name.html
how to set lop command? or change fetcharr to fetsharr_row ?

<?php

$name = $fetcharr['idol_name'];
$address = $fetcharr['address_i'];
$star = $fetcharr['rating'];

//generate HTML for the idol page

$html="
<head><title>Quizzy.net - Quizzes and Personality
Tests</title>\n
<link rel=stylesheet
href=".SITE_URL."templates/ styles.css></head>\n
<table align=center width=600>\n
<tr><td><b>$name</b></a><br><b>Address</b>$address<img src=\"$star.gif\"/> </td></tr> \n";

//generate file name
$fname=str_replace(" ","-",$name);


//open file
$fp=fopen("$fname.html","wb");
fwrite($fp,$html);
fclose($fp);

?>

thank you :D
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Re: php code to save to multiple html from qurery string

Post by onion2k »

Besides the fact you're writing the file as binary ("wb" in fopen() ) instead of text ("w" in fopen() ), I can't really see anything wrong with your code. What's the problem exactly?
yoru_san
Forum Newbie
Posts: 2
Joined: Wed Apr 23, 2008 4:57 am

Re: php code to save to multiple html from qurery string

Post by yoru_san »

i have data in 200-300 rows in mysql
and want to parsing all field in static html page separate by 1 row per 1 page
so i don't know how to make looping command to produce these html files.

thank you for your reply :D
Post Reply