Need sql->html converter

maxywaxy

Registered Member
Joined
Jan 4, 2009
Messages
62
Reaction score
9
I'm looking for a tool/script that creates .html pages for mysql database rows.

So like when you have a database called Food:

england_food is a table which includes:
foodname: foodprice:
1 patatoes 5euro
2 tomates 10 euro
3 bananas 15 euro

The tool or script should create 3 pages automatically with the 3 rows information on each page.

So when I've got like a list of most important citys and countrys i can put those lists in Mysql and the tool/script will create a page for each country with the city for me. And ofcourse this will make unique content this way. Sometimes people have "20.000 pages that I have to upload" I think theyre made this way.

The one that posts the best information gets 2 PR7 backlinks from me if he wants to.

Greetings,

Maxywaxy
 
You will need to use PHP/PERL/... something that can interact with the mysql server to output a html page.
 
i posted code here but now its gone for some reason.
 
?? strange

Anybody that can give me information?
 
i already wrote him a complete script but when i asked what his high PR domains are he never responded.
 
is there such thing a html to php? I havnt heard of the html for sql. I was trying to do the same thing somewhat. But php sucks. so difficult to create.
 
I haven't had any code yet. I've added you to MSn when you sent me a PM where you said you would give me the code.

A simple php echo won't work just read the first post carefully.

And PHP/HTML its just the same doesnt matter which format cuz i can use php in my html pages on my host.

I need something which CREATES the html/php pages so i dont have to make them al one by one.
 
Can be done with php

Here is the basic idea of each page

Page 1
//connect to db
//run query on db - where id = 1
//display's record 1

Page 2
//connect to db
//run query on db - where id = 2
//display's record 2

etc...

So basically all of the pages will be identical the only thing that needs to be generated is the id of the field you want to display, which if they are in order incrementally shouldn't be an issue.

As for the physical page generation, maybe someone else can contribute a page creation script from perl or something.
 
I haven't had any code yet. I've added you to MSn when you sent me a PM where you said you would give me the code.

A simple php echo won't work just read the first post carefully.

And PHP/HTML its just the same doesnt matter which format cuz i can use php in my html pages on my host.

Nobody said anything about a simple echo working, of course it won't you need to select the data from the DB first.

PHP/HTML isn't the same at all, and no you can't run php in your .html page.

Ok, you seem to have it all figured out then.
 
Thanks for your 'by-the-hand' reply sweet funny.
Yes I can use PHP in html pages, when I say so i'm not talking bs. Search for it on google or ask it nicely if youre interested.

Thx for the other replys.

Yes I know that I should run a query but is there no public script or tool that will create those 10.000 html/php query pages for me cuz i dont want to change the query id 10.000 times

 
^I'd be interested in how to put php in an html page.

If I save the page as whatever.html. Even if I put the <?php ?> in there it doesn't parse the php. I guess one could iframe a php page on an html page. I'm sure we'd all be interested in the info.

As for your page generator maybe look in the direction of article spinners (but instead of an article see if you can use html code etc...)
 
As i said, .php wont "just" run in .html pages.

Yes you can force it to do it using AddHandler in .htaccess but some hosts don't enable it. The simplest solution is just write your php using the .php extension like normal, then mod_rewrite it to .html if it's so important to use that extension.
 
here you go. you will have to set user write permissions for the folder where the script is executed.
PHP:
<?php
$sqlserver = "";
$sqluser = "";
$sqlpassword = "";
$sqldatabase = "";
$dblink = mysql_connect($sqlserver, $sqluser, $sqlpassword);
mysql_select_db($sqldatabase) or die(mysql_error() );
  
$tabledata = mysql_query('SELECT * FROM england_food');
  
$num = mysql_numrows($tabledata);
$i=0;
while ($i < $num) {
  $foodname = mysql_result($tabledata,$i,"foodname");
  $foodprice = mysql_result($tabledata,$i,"foodprice");
  $towrite = "$i - $foodname - $foodprice";
  $filename = "$foodname-$i.php";
  if (!$handle = fopen($filename, "w") ) {
    echo "Cannot open file ($filename)";
  }
  if (@fwrite($handle, $towrite) === FALSE) {
    echo "Cannot write to file ($filename)";
  } else {
    echo "$filename has been created";
  }
  $i++;
  fclose($handle);
}
  
?>
 
You can use the .html extension to run as a .php file, it's just a trick with .htaccess :-)
 
Thanks alot for the code looks good, gonna test it out now. And you will get the PR7 backlinks from me.

Put this in .htaccess to get php in html files working:
Code:
AddType application/x-httpd-php htm html php
AddHandler application/x-httpd-php .htm .html

I'll post again if its all working. Thanks alot everybody so far, my first topic and the result is good:) I'll keep posting in these forums.
 
Thanks alot for the code looks good, gonna test it out now. And you will get the PR7 backlinks from me.

Put this in .htaccess to get php in html files working:
Code:
AddType application/x-httpd-php htm html php
AddHandler application/x-httpd-php .htm .html
I'll post again if its all working. Thanks alot everybody so far, my first topic and the result is good:) I'll keep posting in these forums.

np. can you pm me links to your high pr sites?
 
np. can you pm me links to your high pr sites?

Yes done,

Script works fine, one extra question :P could you make it that it puts the $foodname and $foodprice in $i itselves aswell? So it also fills the content of the pages with the rows.
 
wow. the information maxywaxy gave me in exchange for that script is priceless. Definitely wasn't expecting that. I feel sorry for any coder who saw his OP and decided to pass it up.
 
"PHPMaker is a powerful automation tool that can generate a full set of PHP quickly from MySQL database. Using PHPMaker, you can instantly create Web sites that allow users to view, edit, search, add and delete records on the Web. PHPMaker is designed for high flexibility, numerous options enable you to generate PHP applications that best suits your needs. The generated codes are clean, straightforward and easy-to-customize. The PHP scripts can be run on both Windows or Linux/Unix servers. PHPMaker can save you tons of time and is suitable for both beginners and experienced develpers alike."

worth to try
 
Back
Top