- Joined
- Feb 22, 2008
- Messages
- 2,404
- Reaction score
- 724
This is the main function:
Ok, this might be a 'lil bit confusing to you atm, but its just how PHP manage classes.
Now we do:
This would give 1000 to MyChar.
:laugh: I think chumpy might lost his place to me muahahaha, nahh, I'm just kiding. He is better than me. See ya.
Code:
class SQL
{
function __construct()
{
// SQL CONFIGURATIONS GOES HERE
$this->host = "CASA\SQLEXPRESS";
$this->senha = "123456";
$this->user = "sa";
}
}
class cabal extends SQL
{
function conectar_sql()
{
$connection_string = 'DRIVER={SQL Server};SERVER='.$this->host.';DATABASE=ACCOUNT';
$connection = odbc_connect( $connection_string, $this->user, $this->senha );
if(!$connection)
{
return trigger_error("Falha ao conectar com SQL! Verifique os dados e tente novamente.",E_USER_ERROR);
}else{
return $connection;
}
}
function GiveAlz($quantidade,$char)
{
$connection = $this->conectar_sql();
$query = sprintf("UPDATE [gamedb].[dbo].[cabal_character_table] SET [Alz] = '%d' WHERE [Name] = '%s' ",$quantidade,$char);
$go = odbc_exec($connection,$query);
odbc_free_result($go);
if($go){return true;}else{ return false;}
}
}
Ok, this might be a 'lil bit confusing to you atm, but its just how PHP manage classes.
Now we do:
Code:
$cabal = new cabal; // instanciating the class
$cabal->GiveAlz(1000,'MyChar');
:laugh: I think chumpy might lost his place to me muahahaha, nahh, I'm just kiding. He is better than me. See ya.