Jump to content
Fórum Script Brasil
  • 0

Chamada de Storage Procedure


Uander
 Share

Question

Boa tarde a todos, tenho uma simples procedure de insert feita em mysql (workbench), estou começando agora a mecher com programação e quero focar em php e mysql.

/*banco*/

CREATE DATABASE BRINCANDO;

USE BRINCANDO;

#DROP TABLE USUARIO;

CREATE TABLE USUARIO(

ID_USUARIO INT AUTO_INCREMENT NOT NULL,

USUARIO VARCHAR(30),

SENHA VARCHAR(20),

PRIMARY KEY(ID_USUARIO)

);

#DROP PROCEDURE INSEREUSUARIO;

DELIMITER $$

CREATE PROCEDURE INSEREUSUARIO

(

IN PRO_USU_NOME VARCHAR(30),

IN PRO_USU_SENHA VARCHAR(20)

)

BEGIN

IF(NOME='') THEN

SELECT 'INSIRA NOME' AS Msg;

ELSE IF(SENHA='') THEN

SELECT 'INSIRA SENHA' AS Msg;

ELSE

INSERT INTO USUARIO

(USUARIO, SENHA)

VALUES(PRO_USU_NOME, PRO_USU_SENHA);

END IF;

END IF;

SELECT 'DADOS INSERIDOS COM SUCESSO' AS Msg;

END $$

DELIMITER ;

CALL INSEREUSUARIO('UANDER2','123456');

--------------------------------------------------------------------------------

E agora, qual o procedimento a ser usado no php para executar procedure INSEREUSUARIO

abraço

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



  • Forum Statistics

    • Total Topics
      150.2k
    • Total Posts
      647.5k
×
×
  • Create New...