Jump to content

Get data from my results


Glen

Recommended Posts

Hello again ,

 

I was wondering if it was possible to get results from my results i get from mysql output. For example my script returns the player id's of a certain clan i play in, in a game called tribalwars.  Tribalwars offers you the chance to download data to make external sites, statistics ect.  I have downloaded all the villages, players and clans world data in to a mysql database.  And i am trying to find all the villages belong to a certain clan.  There is not a file to download that gives you all the villages of a clan so i will have to make it.  It will have to work like this, Each village, player and clan has its own id.  So i will have to find all the players in a clan and find all the villages belonging to all those players in that clan, but i am not sure how i would go about that.

 

<?php

set_time_limit(300);

//Connect to Mysql 
$dbhost = '';
$dbuser = '';
$dbpass = '';

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

//Select Database
$dbname = '';
mysql_select_db($dbname) or die('Error selecting database');

//Select table

$query="SELECT * FROM players WHERE ally = '2463'";
$result=mysql_query($query);

//Find the number of rows
$num_rows = mysql_num_rows($result) or  die(mysql_error());

//Loop
$i=0;
while ($i < $num_rows) {

$id=mysql_result($result,$i,"id");
$name=mysql_result($result,$i,"name");
$ally=mysql_result($result,$i,"ally");
$villages=mysql_result($result,$i,"villages");
$points=mysql_result($result,$i,"points");
$rank=mysql_result($result,$i,"rank");

echo "<br>ID: $id<br>";
$i++;
}


mysql_close();


?>

 

This current code displays all the player id's of this clan how can i use those id's to find all of thier villages.

 

 

Thanks for your time

 

-Glen

Link to comment
https://forums.phpfreaks.com/topic/130012-get-data-from-my-results/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.