By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,377 Members | 1,722 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,377 IT Pros & Developers. It's quick & easy.

problem with stored prodedure :-(

P: 1
hi all , I had create a procedure stored in mysql 5.1 this is its code:
Expand|Select|Wrap|Line Numbers
  1. CREATE PROCEDURE `verif_numtel` (IN login varchar(10), IN numero INT,INOUT erreur INT) DETERMINISTIC
  2. BEGIN
  3. SET erreur= 0;
  4.  
  5. IF(numero<0) THEN SET erreur= 1;
  6.  
  7. ELSE INSERT INTO Membre_de_bureau (loginMB,num_telMB) VALUES (login, numero);
  8.  
  9. END IF;
  10.  
  11. END;//
and i try to call him in php to use this code:

Expand|Select|Wrap|Line Numbers
  1. try
  2. {
  3.     $bdd = new PDO('mysql:host=localhost;dbname=club_investissement1', '****', '****');
  4. }
  5. catch (Exception $e)
  6. {
  7.         die('Erreur : ' . $e->getMessage());
  8. }
  9. $log = 'prince';$numtel = 555; $err = 0;
  10.  
  11.  
  12. $req =$bdd->prepare("CALL verif_numtel(?,?,?)");
  13. $req->bindParam(1, $log, PDO::PARAM_STR, 10);
  14. $req->bindParam(2, $numtel, PDO::PARAM_INT);
  15. $req->bindParam(3, $err, PDO::PARAM_INT|PDO::PARAM_INPUT_OUTPUT);
  16. $req->execute();
  17.  print "procedure returned $err \n";
but the code would not work and i don't no what the probleme if can anywone can help me please?
(ps sorry for my bad english i'm french women ....)
May 19 '10 #1
Share this Question
Share on Google+
1 Reply


Dormilich
Expert Mod 5K+
P: 8,639
I would have done the check ($numero < 0) on the PHP side, so that you don’t have to use a stored procedure …

Did you try to execute the Stored Procedure directly? (e.g. in phpMyAdmin or any other DB interface)
May 19 '10 #2

Post your reply

Sign in to post your reply or Sign up for a free account.