alsopranos Posted April 17, 2012 Share Posted April 17, 2012 Bonjour, je souhaite ajouter un nouveau champ au formulaire d'inscription lié à un nouveau tableau (card) qui contient des différents codes avec le champ active (0 ou 1) lorsque le client tape le code s'il n'est pas utilisé il contient l'inscription est le champ code passe de 0 vers 1 si non il demande un nouveau code actif, j'ai crée une nouvelle classe avec le nom de tableau (card): class Code extends ObjectModel { public $id; public $code_card; protected $tables = array ('card'); protected $fieldsRequired = array('code_card'); protected $fieldsSize = array('lastname' => 16); protected $table = 'card'; protected $identifier = 'id_card'; public function getFields() { parent::validateFields(); if (isset($this->id)) $fields['id_card'] = intval($this->id); $fields['code_card'] = pSQL($this->code_card); return $fields; } /*la fonction qui vérifie si le code est utilisé ou non*/ public static function isBanned($id_card) { if (!Validate::isUnsignedId($id_card)) return true; $result = Db::getInstance()->getRow(' SELECT `id_card` FROM `'._DB_PREFIX_.'card` WHERE `id_card` = \''.intval($id_card).'\' AND active = 1 AND `deleted` = 0'); if (isset($result['id_card'])) return false; return true; } Ensuite je suis bloqué ( Merci de m'aider svp Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now