Help - Search - Members - Calendar
Full Version: Database Extraction Phpbb
Zymic Webmaster Forums > Zymic Free Web Hosting > Databases & MySQL
josephff
Im trying to use the information from the PHPBB database in another page on my site.

This what i have pieced together so far. Its not working and i am a total noob at PHP so if anyone could help i would greatly appreciate it.

***************************

<?php
$host = "localhost";
$user = "****_**********";
$pass = "******";

$connection = mysql_connect($host,$user,$pass) or die (mysql_errno().": ".mysql_error()."<BR>");

$sql = "select * from phpbb_users where id=" . $_POST['username'] . " and ='" . userocc $_POST['user_occ'] . "'";
echo $sql;

$dbname = "619america_clanteam_phpbb";
mysql_select_db($dbname);

resource mysql_query ( string query [, resource link_identifier])

$query = mysql_query($sql);

array mysql_fetch_array ( resource result [, int result_type])

while ($row = mysql_fetch_array($query)) {
echo "<p>",$row['id'],": ",$row['userocc'];

?>

*********************************
josephff
Ok well i got the code working and i can pull up all data in table.

how do i pinpoint a certain row and that row only?
uncled1023
Well, thats all you have displaying on the page, either by print or echo. That is what is supposed to display on the page by the code you showed.
josephff
QUOTE(uncled1023 @ Feb 13 2010, 03:26 AM) *
Well, thats all you have displaying on the page, either by print or echo. That is what is supposed to display on the page by the code you showed.


yeah sorry i didnt read all the tutorial

code is now :

QUOTE
<html>
<body>

<?php
$dbhost = 'localhost';
$dbuser = '****_**********';
$dbpass = '******';
$dbname = '619america_clanteam_phpbb/phpbb_users';


$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');
mysql_select_db($dbname);

print "Connected to MySQL<br>";

$selected = mysql_select_db("619america_clanteam_phpbb",$conn)
or die("Could not select phpbb");

print "Connected to MySql Select<br>";


$result = mysql_query("SELECT * FROM phpbb_users");

while($row = mysql_fetch_assoc($result)){
echo "Name:".$row['username']
.", Job:".$row['user_occ'].", From:".$row['user_from']."<br/>";
}

echo $result;

mysql_close($conn);

?>


i need to pinpoint one row and pick the fields from that row
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2012 Invision Power Services, Inc.