NOUVELLE VERSION !!! Des nouvelles classes de partout, et des supers procédures SQL.
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
class Message{
|
||||
|
||||
public static function postMessage($sid,$mdp,$did,$text){
|
||||
|
||||
$req = $GLOBALS['bdd']->prepare('CALL `PostMessage`(:sid,:mdp,:did,:text,@o);');
|
||||
$req->bindValue(':sid', $sid);
|
||||
$req->bindValue(':mdp', $mdp);
|
||||
$req->bindValue(':did', $did);
|
||||
$req->bindValue(':text', $text);
|
||||
$req->execute();
|
||||
$rep = $GLOBALS['bdd']->query('SELECT @o AS outputCode')->fetch();
|
||||
|
||||
if($rep['outputCode'] != 42)throw new SQLProcessingException($rep['outputCode']);
|
||||
}
|
||||
|
||||
public static function deleteMessage($sid,$mdp,$mid){
|
||||
|
||||
$req = $GLOBALS['bdd']->prepare('CALL `DeleteMessage`(:sid,:mdp,:mid,@o);');
|
||||
$req->bindValue(':sid', $sid);
|
||||
$req->bindValue(':mdp', $mdp);
|
||||
$req->bindValue(':mid', $mid);
|
||||
$req->execute();
|
||||
$rep = $GLOBALS['bdd']->query('SELECT @o AS outputCode')->fetch();
|
||||
|
||||
if($rep['outputCode'] != 42)throw new SQLProcessingException($rep['outputCode']);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user