•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 427,376 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,989 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 488 | Replies: 2
![]() |
•
•
Join Date: Dec 2007
Posts: 71
Reputation:
Rep Power: 1
Solved Threads: 0
Hello everyone,
Im once having problems trying to retrieve information from one of my tables.
I have a table with the following information:
I am able to retrieve the information as basic but the problem is I need to somehow match the [user] number above to match up to the [id] number below and then display the [username] in the list.
This is what I have tried and it doesnt seem to work :O( And so I would apreciate any feedback or help. Thanks
Thanks
Justin
Im once having problems trying to retrieve information from one of my tables.
I have a table with the following information:
CREATE TABLE `island2` ( `id` int(10) unsigned NOT NULL auto_increment, `user` int(11) NOT NULL default '0', `island` int(11) NOT NULL default '0', `town` int(11) NOT NULL default '0', `village` int(11) NOT NULL default '0', `islandrank` int(11) NOT NULL default '0', `townrank` int(11) NOT NULL default '0', `villagerank` int(11) NOT NULL default '0', `game` int(11) NOT NULL default '0', `dateregistered` int(11) NOT NULL default '0', PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=6366 ;
I am able to retrieve the information as basic but the problem is I need to somehow match the [user] number above to match up to the [id] number below and then display the [username] in the list.
CREATE TABLE `members2` ( `id` int(10) unsigned NOT NULL auto_increment, `username` varchar(16) NOT NULL default '', `password` varchar(32) NOT NULL default '', `display_name` varchar(20) NOT NULL default '', `display_prem` text NOT NULL, `points` int(11) NOT NULL default '4000', `age_check` tinyint(4) NOT NULL default '0', `rank` tinyint(4) NOT NULL default '0', `hunger_level` int(11) NOT NULL default '7', `viewed_update` tinyint(4) NOT NULL default '0', `referer` varchar(16) NOT NULL default '0', `game` int(11) NOT NULL default '0', `location` varchar(32) NOT NULL default '', `post_count` int(11) NOT NULL default '0', `global_post_count` int(11) NOT NULL default '0', `active_pet` int(11) NOT NULL default '0', `premium` tinyint(4) NOT NULL default '0', `verify` tinyint(1) NOT NULL default '1', PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=81 ;
This is what I have tried and it doesnt seem to work :O( And so I would apreciate any feedback or help. Thanks
$interactive = 1;
$page_title = "TEST ISLAND";
$rank_check = 1;
include "header.inc.php";
$game=$_GET['game'];
// Get all the data from the "example" table
$result = mysql_query("SELECT * FROM island2 WHERE island ='1' AND town ='1' AND village ='1'")
or die(mysql_error());
$memberdata = mysql_query("SELECT user FROM island2 WHERE island = '1' AND town = '1' AND village = '1'")
$member = fetch("SELECT username FROM members2 WHERE $memberdata=$userid");
echo "<p align=center> </p>
<p align=center> </p>
<p align=center><b><font face=Arial size=5>VILLAGE 1</font></b></p>
<p align=center> </p>
<p align=center><a href=http://www.cyberpetworld.com/1village.pro.php>Join
This Village</a></p>
<p align=center> </p>
<p align=center> </p>
<p align=center><b><u>Village Members Listed Here</u></b></p>
<p align=center> </p>";
echo "<center><table border='1'>";
echo "<tr> <center><th>Name</th> </tr>";
// keeps getting the next row until there are no more to get
while($row = mysql_fetch_array( $result )) {
// Print out the contents of each row into a table
echo "<tr><td>";
echo $row['user'];
echo "</td></tr>";
}
echo "</table>";
?>Thanks
Justin
•
•
Join Date: Aug 2007
Location: Cavite,Philippines
Posts: 508
Reputation:
Rep Power: 3
Solved Threads: 68
I think you have missed the semi colon here:
php Syntax (Toggle Plain Text)
$memberdata = mysql_query("SELECT user FROM island2 WHERE island = '1' AND town = '1' AND village = '1'")
"death is the cure of all diseases..."
http://ryantetek.wordpress.com
http://ryantetek.wordpress.com
![]() |
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
access advice broadband business c++ classification code combo crime cult of the dead cow daniweb data data protection data transfer database drive dropdownlist encryption europe forensic forensics google government hacking hard hardware help hitachi hp industrial espionage internet it linux mmorpg mobile module mysql net news payment services privacy protection reuse search security storage terabyte tv web wikipedia
- MS Access vs. MySQL (MS Access and FileMaker Pro)
- php/mysql dynamic multi-level menu problem (MySQL)
- MySQL SELECT question (PHP)
- AJAX generated <select> and FIREFOX (JavaScript / DHTML / AJAX)
- Displaying Images( buffered data ) from the Database using Java (Java)
- dynamic dropdowm list and mysql (PHP)
- Help connecting to mysql tables (JSP)
- Pro*C to Mysql C API (C++)
- bringing data from mysql using select box (PHP)
- Problem connecting my Tomcat Server and MySQL using JSP (JSP)
Other Threads in the PHP Forum
- Previous Thread: Select random database value?
- Next Thread: wth?


Linear Mode