Firefox PHP

Creating a text file from Phorum3 postings.

Posted by Martijn 
Creating a text file from Phorum3 postings.
October 21, 2005 12:36PM
Hello,

I would like to make a big textfile from all the posting on a phorum3 site which I still run. In this way I can shutdown the phorum, but still give my visitors the opportunity to search threw the old postings.

I tried to mysqldump the complete database, but that's not what I am looking for.

I think I only need certain tables from the database?

Does anybody know howto get the job done?

Grtz
Martijn Janssen
Re: Creating a text file from Phorum3 postings.
October 21, 2005 04:34PM
you should create a script which looks at the tables and writes out some html-files with the posts.


Thomas Seifert
Phorum Development Team / Mysnip-Solutions.de
Custom Phorum and general software development
worry-free Phorum Hosting
Re: Creating a text file from Phorum3 postings.
October 23, 2005 12:51PM
Thanks,

I am working on a script, but feeling like (bad) painter without a brush.
The PHP language is still abacadabra for me.

With some command line mysql (yep I am learning new things all the time) I found out that these 3 tables hold the phorum3 stuff.

mysql> show TABLES;
+------------------------------+
| Tables_in_mydatabase |
+------------------------------+
| myforum |
| myforum_bodies |
| forums |
+------------------------------+

mysql> describe myforum;
+-------------+---------------------+------+-----+---------------------+-------+| Field | Type | Null | Key | Default | Extra |+-------------+---------------------+------+-----+---------------------+-------+| id | bigint(20) unsigned | | PRI | 0 | || datestamp | datetime | | MUL | 0000-00-00 00:00:00 | || thread | int(11) | | MUL | 0 | || parent | int(11) | | MUL | 0 | || author | char(37) | | MUL | | || subject | char(255) | | MUL | | || email | char(200) | | | | || attachment | char(64) | | | | || host | char(50) | | | | || email_reply | char(1) | | | N | || approved | char(1) | | MUL | N | || msgid | char(100) | | MUL | | |+-------------+---------------------+------+-----+---------------------+-------+12 rows in set (0.01 sec)


mysql> describe myforum_bodies;
+--------+---------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+--------+---------------------+------+-----+---------+----------------+
| id | bigint(20) unsigned | | PRI | NULL | auto_increment |
| body | text | | | | |
| thread | int(11) | | MUL | 0 | |
+--------+---------------------+------+-----+---------+----------------+
3 rows in set (0.01 sec)

I wrote a "script" (ahummmm????) with this in it :

$query = 'SELECT body FROM myforum_bodies';
$result = mysql_query($query) or die('Query failed: ' . mysql_error());

for ($i = 0; $i < 5649; ++$i) {
echo ("<BR>");
echo mysql_result($result,$i);

}

This gives me a page with all the text from the posts, but it is a mess.

At the moment I am looking into the source code of phorum3 to find out how you guy's are doing it, but at the moment it's still to difficult for me.

I think I need to be in read.php but could find anything usefull yet.

What I am looking for is a script which makes one static page of all the threads.
Only the subject, author, data, and the actual text of all the threads, something like a static archive.

Some more tips are vere much appreciated.

Grtz
Martijn
Sorry, you do not have permission to post/reply in this forum.