Jump to content

Archived

This topic is now archived and is closed to further replies.

tecdesign

myssql problem

Recommended Posts

I know this is php but I need this for a php section. Could someone please help? The code is the following


CREATE PROCEDURE hire_toy @memberid int = NULL, @toyid int = NULL, @hiredate datetime = NULL AS --IF @memberid = NULL PRINT 'Mem is null' --IF @toyid = NULL PRINT 'toy is null' --IF @hiredate = NULL PRINT 'hiredate is null' IF(@memberid = NULL OR @toyid = NULL OR @hiredate = NULL) BEGIN RAISERROR('Please enter all required parameters: Member id, Toy id, Hiredate',16,1) RETURN END print 'debug 0' INSERT INTO Hire (Member_Id, Toy_Id, Hire_Date) VALUES (@memberid, @toyid, @hiredate) print 'debug 1' IF @@ERROR <> 0 BEGIN print 'error occured' END ELSE BEGIN print 'updating toy status: id: ' + CONVERT(varchar(16), @toyid) UPDATE Toys SET Status = 'Hired' WHERE Id = @toyid END print 'debug 2'

- Only gets output of: debug 0 - Updates fine but nothing beyond the insert is executed!?

So once the information has been inserted into Hire it does nothing else? It seems strange is there anyone who can help?

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.