0

I have this procedure called updates:

DROP PROCEDURE IF EXISTS `updates`$$
CREATE DEFINER=`root`@`localhost` PROCEDURE `updates` (IN `ids` INT(11), IN `name` VARCHAR(20), IN `ape` VARCHAR(20), IN `pass` VARCHAR(20), IN `dpto` VARCHAR(20), IN `rols` VARCHAR(20))  BEGIN
UPDATE usuario SET name_user=name, apellidos=ape, pw_user = pass, depto=dpto, rol_user=rols WHERE id_user=ids;
END$$

And this is my php code:

$query= "CALL updates('".$_POST['id_user']."','".$_POST["usern"]."' ,'".$_POST["apell"]."' ,  '".$_POST["passwd"]."' , '".$_POST["depto"]."' , '".$_POST["rolu"]."')";

But it doesn't execute, please help :(

  • use single quotes around names in post array – jophab Aug 17 '16 at 03:33
  • What is result of store procedure call? Is there any error? – chirag Aug 17 '16 at 04:39
  • Use error reporting ([`mysql_error()`](http://php.net/manual/en/function.mysql-error.php), [`mysqli_error()`](http://php.net/manual/en/mysqli.error.php), [`PDO::errorInfo()`](http://php.net/manual/en/pdo.errorinfo.php), depending on what you use). – Gerald Schneider Aug 17 '16 at 07:15

1 Answers1

0

Try something like this..

$query = "{CALL dbo.updates
('".$_POST['id_user']."','".$_POST["usern"]."' ,'".$_POST["apell"]."'
,  '".$_POST["passwd"]."' , '".$_POST["depto"]."' ,
'".$_POST["rolu"]."') }";
Don Cerilo
  • 26
  • 2