Author Topic: Making a better flexible class for sports manager  (Read 500 times)

Offline pavansss91

  • Level 18
  • *
  • Posts: 185
  • Reputation: +1/-0
    • View Profile
Making a better flexible class for sports manager
« on: June 09, 2009, 12:11:51 PM »
I don't know if it's useful or not but i am pasting this code

Code: [Select]
<?php
class team
{
 var 
$id;
 var 
$g1;
.......
//similiar match positions variables

 
function team($id)
 {
  
$this->id=$id;
  
$this->initstats($id);
  return 
true;
 }

 function 
pq($match_pos,$id)
 {
  
$query=mysql_query("select * from players where id='$id' and match_pos='$match_pos'");
  if(empty(
$query))
   return 
false;
  else
   return 
mysql_fetch_object($query);
 }

 function 
initstats($id)
 {
  
$this->g1=$this->pq(1,$id);

  return 
true;   
 }

}
/*------------------------------------------------------------------------------------------------------------------------*/
class match
{
 var 
$a;
 var 
$b;
 var 
$schedule;

 function 
match($id)
 {
  
$this->initstats($id);
  return 
true;
 }
 
 function 
initstats($id)
 {
  
$this->schedule=mysql_fetch_object(mysql_query("select * from schedules where sch_id='$id'"));
  
$this->a=new team($this->schedule->home_id);
  
$this->b=new team($this->schedule->away_id);
  return 
true;
 }
 
}
/*---------------------------------------------------------------------------*/

$mh= new match(28);

match_exec()
//your game engine
?>

It's my code not copied

Thanks
« Last Edit: June 12, 2009, 08:24:09 AM by pavansss91 »
bbgFramework v0.1.3
Sun Database Class v0.3

 


SimplePortal 2.3.3 © 2008-2010, SimplePortal