title: Missing argument in Class
body: <p>i am quite new at Object oriented Programming and i can't manage to find why this practice project I have is wrong. It keeps giving me the folliwng error message:</p>
  
  <p>"Warning: Missing argument 2 for Character::__construct(), called in C:\Users\User\Documents\NetBeansProjects\PhpProject3\poo_bdd\connect_bdd.php on line 26 and defined in C:\Users\User\Documents\NetBeansProjects\PhpProject3\poo_bdd\Character.class on line 13
   and same for argument 3 to 6</p>
  
  <p>Definition of the class</p>
  
  <pre><code>&lt;?php
  class Character 
      {
          //attributs de la classe
          private $_id;
          private $_name;
          private $_strength;
          private $_damage;
          private $_level;
          private $_experience;
  
          //on définit le constructeur
          public function __construct($id, $name,$strength,$damage,$level,$experience) 
          {
              $this-&gt;setId($id);
              $this-&gt;setName($name);
              $this-&gt;setStrength($strength);
              $this-&gt;setDamage($damage);
              $this-&gt;setLevel($level);
              $this-&gt;setExperience($experience);
          }
  
          //hydratation 
          public function hydrate(array $data)
          {
              foreach ($data as $key =&gt; $value)
              {
                  $method = 'set'.ucfirst($key);
  
                  if (method_exists($this, $method))
                  {
                      $this-&gt;$method($value);
                  }
              }
  
              if(isset($data['id']))
              {
                  $this-&gt;setId($data['id']);
              }
              if(isset($data['name']))
              {
                  $this-&gt;setName($data['name']);
              }
              if(isset($data['strength']))
              {
                  $this-&gt;setStrength($data['strength']);
              }
              if(isset($data['damage']))
              {
                  $this-&gt;setDamage($data['damage']);
              }
              if(isset($data['level']))
              {
                  $this-&gt;setLevel($data['level']);
              }
              if(isset($data['experience']))
              {
                  $this-&gt;setExperience($data['experience']);
              }
  
          }
  
          //on définit les getters et setters
              //getters
          public function getId()
          {
              return $this-&gt;_id;
          }
          public function getName()
          {
              return $this-&gt;_name;
          }
          public function getStrength()
          {
              return $this-&gt;_strength;
          }
          public function getDamage()
          {
              return $this-&gt;_damage;
          }
          public function getLevel()
          {
              return $this-&gt;_level;
          }
          public function getExperience()
          {
              return $this-&gt;_experience;
          }
  
              // setters
          public function setId($id)
          {
                $this-&gt;_id = (int) $id;
          }
  
          public function setName($name)
          {
              if (is_string($name) &amp;&amp; strlen($name) &lt;= 30)
              {
                  $this-&gt;_name = $name;
              }
          }
  
          public function setStrength($strength)
          {
              $this-&gt;_strength = $strength;
          }
  
          public function setDamage($damage)
          {
              $this-&gt;_damage = $damage;
          }
  
          public function setLevel($level)
          {
              $this-&gt;_level = $level;
          }
  
          public function setExperience($experience)
          {
              $this-&gt;_experience = $experience;
          }
  
  
       }
  </code></pre>
  
  <p>?></p>
  
  <p>And the php code:</p>
  
  <pre><code>&lt;?php
  
  require ('Character.class');
  
  try
      {
  
              //connexion à la table blog_messages 
              $pdo_options[PDO::ATTR_ERRMODE] = PDO::ERRMODE_EXCEPTION;
              $bdd = new PDO('mysql:host=localhost;dbname=test; charset=UTF-8', 'root', '', $pdo_options);
              $bdd-&gt;query('SET NAMES utf8');
  
              //sélection des 3 derniers billets
              $request = $bdd-&gt;query('SELECT id, name, strength, damage, level, experience FROM personnages');
  
              //affichage des billets
              while ($data = $request-&gt;fetch(PDO::FETCH_ASSOC))
                  {
                      $character = new Character($data);
  
                      echo $character-&gt;getName(),' has a strength of',$character-&gt;getStrength();
                  }
              //on termine le traitement de la requète
              $request-&gt;closeCursor();
     }
          catch (Exception $e)
              {
                  die('Erreur: '.$e-&gt;getMessage());
              } 
  </code></pre>
  
  <p>?></p>
  
  <p>The SQL tbale has 6 columns: id, name, strength, damage, level, experience.</p>
  
  <p>If anybody has a clue, that would be great.</p>
  
  <p>Thanks for your help!</p>