Can This Be Done

This is an archive of the phpBB 2.0.x support forum. Support for phpBB2 has now ended.
Forum rules
Following phpBB2's EoL, this forum is now archived for reference purposes only.
Please see the following announcement for more information: viewtopic.php?f=14&t=1385785
Locked
merebel
Registered User
Posts: 195
Joined: Mon Mar 13, 2006 6:18 pm
Location: Lewiston, Maine

Can This Be Done

Post by merebel » Wed Aug 23, 2006 7:54 pm

Is it possible to use a mysql script to get the profiles information out of phpbb to create a page that can display there info with a picture from another file to create a members bio page that can be viewed by the public???

And if so can some one help me with that I am very new to mysql and trying to write anything like that


Thanks
Keith

MikeR2k6
Registered User
Posts: 62
Joined: Fri Aug 18, 2006 6:18 pm
Location: UK
Contact:

Post by MikeR2k6 » Wed Aug 23, 2006 8:20 pm

yes it is. use PHP scripting to build a page to query the forum's database, and extract the users' information. once this is done, it should display the information preferably in a table. you can choose all users' information or just specific users, depending on how you query it.

for help with MySQL see http://www.php.net/manual/en/ref.mysql.php

merebel
Registered User
Posts: 195
Joined: Mon Mar 13, 2006 6:18 pm
Location: Lewiston, Maine

Post by merebel » Wed Aug 23, 2006 8:32 pm

Mike Thanks I will have to read that

Also as a side note by your user name are you part of the astromecs building group???


Keith

MikeR2k6
Registered User
Posts: 62
Joined: Fri Aug 18, 2006 6:18 pm
Location: UK
Contact:

Post by MikeR2k6 » Wed Aug 23, 2006 8:40 pm

nothing to do with it, sorry :lol:

anyway i'd post some example sql queries for you, but its been a long time since i've programmed php, would need to brush up on the coding myself

GreyDogz
Registered User
Posts: 200
Joined: Tue May 16, 2006 11:59 am

Post by GreyDogz » Wed Aug 23, 2006 9:08 pm

GreyDogz wrote: Use something like this: (edit it to meet your needs)

Code: Select all

<?php
include 'config.php';
include 'opendb.php';

$query  = "SELECT username, user_email, user_website FROM users";
$result = mysql_query($query);

while($row = mysql_fetch_row($result))
{
    $name    = $row[0];
    $email = $row[1];
    $website = $row[2];


    echo "Name :$name <br>" .
         "Email : $email <br>" . 
         "Homepage : $website <br><br>";
} 

include 'closedb.php';
?> 
Use these as the input files:

Code: Select all

<?php
// This is an example of config.php
$dbhost = 'localhost';
$dbuser = 'root';
$dbpass = 'password';
$dbname = 'phpbb';
?> 

Code: Select all

<?php
// This is an example opendb.php
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die                      ('Error connecting to mysql');
mysql_select_db($dbname);
?> 

Code: Select all

<?php
// an example of closedb.php
// it does nothing but closing
// a mysql database connection

mysql_close($conn);
?>

merebel
Registered User
Posts: 195
Joined: Mon Mar 13, 2006 6:18 pm
Location: Lewiston, Maine

Post by merebel » Thu Aug 24, 2006 2:30 am

GreyDogz,

Thanks for the info

I would need to create the config.php opendb and closedb myself or is there something like that in phpbb that I can already use???

Sorry I am new to the whole sql part


Keith

GreyDogz
Registered User
Posts: 200
Joined: Tue May 16, 2006 11:59 am

Post by GreyDogz » Thu Aug 24, 2006 10:09 am

The opendb.php and closedb.php will work as list above. They are very simple files as you can see. If fact, as you can see you could edit the main file and remove the includes and just add the actually portions of each file into the main file.

The main file would also need to be edited to pull the info you want from the DB and incorporate it into the webpage you are creating to display it. This should get you started though.

merebel
Registered User
Posts: 195
Joined: Mon Mar 13, 2006 6:18 pm
Location: Lewiston, Maine

Post by merebel » Thu Aug 31, 2006 1:10 am

Ok I got it setup but when I try I get this error

Code: Select all

Fatal error: Cannot redeclare class template in /homepages/46/d156343948/htdocs/phpBB2/includes/template.php on line 74
also how do I select a single member???

Keith

Locked

Return to “2.0.x Support Forum”