Forum Moderators: coopster

Message Too Old, No Replies

create html files from mysql data

i want to create html files from mysql data

         

siddiq ijiff

3:15 pm on Oct 26, 2007 (gmt 0)

10+ Year Member



hello all,
i want to create html files from mysql data,
i already try with this code its creating but mysql total rows are 10 and its adding only one row in the file

mysql connect etc......

$iiiiijhh="$text <br>";

$fp = fopen("dir/page.html","w+");
fwrite($fp,"$iiiiijhh");
fclose($fp);

mysql total rows are 10 but its show only one for example

mysql rows
some text 1<br>
some text 2<br>
some text 3<br>
some text 4<br>
------
its creating file with
--
some text 1<br>
--
only one :(
any idea how to get all in the file

siddiq ijiff

5:16 am on Oct 27, 2007 (gmt 0)

10+ Year Member



no replay :S

bgb76

7:36 am on Oct 27, 2007 (gmt 0)

10+ Year Member



This will help you ... do little change in code

<?php
$con = mysql_connect("localhost","","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}mysql_select_db("my_db", $con);$result = mysql_query("SELECT * FROM person");while($row = mysql_fetch_array($result))
{
echo $row['FirstName'] . " " . $row['LastName'];
echo "<br />";
}mysql_close($con);
?>

ATB
bg

for more on PHP if u have just started here are the links... I too learnt it from here...

[w3schools.com...]

[edited by: eelixduppy at 7:38 am (utc) on Oct. 27, 2007]
[edit reason] removed db specifics [/edit]

siddiq ijiff

9:48 am on Oct 27, 2007 (gmt 0)

10+ Year Member



you cant understand
i want to save real html file in my server but data well get from mysql and i can not use every time php code to create html file i can use this only once and when file well save so user can view the html file not php, its good for search :)

henry0

10:48 am on Oct 27, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If this is the case and if I understand, you are looking to create an HTML file that "exists" and not a dynamic on the fly built page?

Then you need to create a template for that page,
copy it as for ex: page_1.html in any directory
create a link pointing to that page
be sure that you may parse HTML/PHP
if that page is called it will be populated from your DB
but it requires some leg work
do your search try to come with something and comeback here.

siddiq ijiff

11:11 am on Oct 27, 2007 (gmt 0)

10+ Year Member



well my work is done, by using a software...
from software i just download the all of pages and then uploaded to the server, and i think software work is easy and good for me. :)

mysql is very good thing but i think google can not index the page which well not show last updated date :P