10-18-2012, 02:41 PM
You would need to read about Mysql query's and how to use it with php(read about PDO, or Mysqli):
Get character ID(don't forget to sanitize your inputs):
$charName = "MySorc";
query = "SELECT a_index FROM t_characters WHERE a_name ='".$charName."';";
Afteryou got the Id you can simply query the t_invent0-9 from
charID = row["a_index"];
for( $i = 0; $i < 10; $i++){
query = "SELECT * FROM t_inven0".$i." WHERE a_char_idx=".charID.";";
//Execte the query and get the rowand parse it using a_item_idx0,
//a_item_idx1, a_item_idx2, a_item_idx3, a_item_idx4 or any other tables
}
First thing you will need to create an entity class of the table in the database, thatwill hold the table information.
t_invent.class.php
<?php
class t_invent{
//make it private and add get/set methods
public $a_char_idx;
public $a_tab_idx ;
public $a_row_idx;
//....
};
?>
And the Php File that loads everything
<?php
//include your php files
require_once 'Database/t_invent.class.php';
//your program
$inventory = array();
//for every inventory 0-9
for($i = 0 ; $i < 10; $i++ ){
//Create query
// execute query
$inventory[$i] = new t_invent();
$inventory[$i]->a_char_idx = $row["a_char_idx"];
$inventory[$i]->a_tab_idx = $row["a_tab_idx"];
$inventory[$i]->a_row_idx = $row["a_row_idx"];
//...
}
//...
//later in the program later in the program you can access the inventories using $inventory[$num]->field
?>
For simple querys and user input/output I suggest you try to use AJAX + PHP, since its much simpler to make an HTTP request then loading the full page, just to make a simple query.

