Click here to Skip to main content
15,909,741 members
Home / Discussions / Database
   

Database

 
AnswerRe: how to use this code in SQL Pin
Eddy Vluggen8-Oct-13 0:30
professionalEddy Vluggen8-Oct-13 0:30 
QuestionRe: how to use this code in SQL Pin
jojoba208-Oct-13 1:08
jojoba208-Oct-13 1:08 
AnswerRe: how to use this code in SQL Pin
Eddy Vluggen8-Oct-13 5:00
professionalEddy Vluggen8-Oct-13 5:00 
QuestionRe: how to use this code in SQL Pin
jojoba208-Oct-13 5:26
jojoba208-Oct-13 5:26 
SuggestionRe: how to use this code in SQL Pin
Eddy Vluggen9-Oct-13 8:57
professionalEddy Vluggen9-Oct-13 8:57 
QuestionRe: how to use this code in SQL Pin
jojoba208-Oct-13 4:44
jojoba208-Oct-13 4:44 
AnswerRe: how to use this code in SQL Pin
Eddy Vluggen8-Oct-13 9:00
professionalEddy Vluggen8-Oct-13 9:00 
QuestionRe: how to use this code in SQL Pin
jojoba208-Oct-13 18:20
jojoba208-Oct-13 18:20 
AnswerRe: how to use this code in SQL Pin
Richard MacCutchan8-Oct-13 20:42
mveRichard MacCutchan8-Oct-13 20:42 
QuestionRe: how to use this code in SQL Pin
jojoba208-Oct-13 22:23
jojoba208-Oct-13 22:23 
AnswerRe: how to use this code in SQL Pin
Richard MacCutchan8-Oct-13 23:19
mveRichard MacCutchan8-Oct-13 23:19 
QuestionRe: how to use this code in SQL Pin
jojoba208-Oct-13 23:31
jojoba208-Oct-13 23:31 
AnswerRe: how to use this code in SQL Pin
Richard MacCutchan8-Oct-13 23:37
mveRichard MacCutchan8-Oct-13 23:37 
AnswerRe: how to use this code in SQL Pin
Eddy Vluggen9-Oct-13 0:29
professionalEddy Vluggen9-Oct-13 0:29 
QuestionRe: how to use this code in SQL Pin
jojoba209-Oct-13 0:54
jojoba209-Oct-13 0:54 
AnswerRe: how to use this code in SQL Pin
Eddy Vluggen9-Oct-13 5:05
professionalEddy Vluggen9-Oct-13 5:05 
AnswerRe: how to use this code in SQL Pin
Simon_Whale9-Oct-13 6:08
Simon_Whale9-Oct-13 6:08 
AnswerRe: how to use this code in SQL Pin
jschell9-Oct-13 8:04
jschell9-Oct-13 8:04 
QuestionRe: how to use this code in SQL Pin
jojoba209-Oct-13 20:55
jojoba209-Oct-13 20:55 
AnswerRe: how to use this code in SQL Pin
Simon_Whale9-Oct-13 21:56
Simon_Whale9-Oct-13 21:56 
QuestionRe: how to use this code in SQL Pin
jojoba209-Oct-13 22:21
jojoba209-Oct-13 22:21 
AnswerRe: how to use this code in SQL Pin
Simon_Whale9-Oct-13 22:23
Simon_Whale9-Oct-13 22:23 
AnswerRe: how to use this code in SQL Pin
Eddy Vluggen10-Oct-13 0:28
professionalEddy Vluggen10-Oct-13 0:28 
Questionreturning record identity using PDO Pin
Jassim Rahma7-Oct-13 1:03
Jassim Rahma7-Oct-13 1:03 
Hi,

I am using MySQL, PHP and PDO to insert a support ticket. Inserting works fine but I want to get the ticket_id after insertions using OUT from the stored procedure. Can you please help.

here is my stored procedure followed by my PDO code for INSERT.

SQL
CREATE DEFINER=`jassimdb`@`%.%` PROCEDURE `sp_add_new_ticket`(IN param_ticket_name varchar(255), IN param_ticket_email varchar(255), IN param_ticket_subject varchar(255), IN param_ticket_message text, OUT param_record_identity int)
BEGIN
	INSERT INTO support_tickets (ticket_guid, ticket_name, ticket_email, ticket_subject) VALUES (UUID(), param_ticket_name, param_ticket_email, param_ticket_subject);
	SET param_record_identity = LAST_INSERT_ID();
	INSERT INTO support_ticket_messages (ticket_id, support_ticket_message) VALUES (LAST_INSERT_ID(), param_ticket_message);
END


PHP
$mysql_query = $mysql_connection->prepare("CALL sp_add_new_ticket(:param_ticket_name, :param_ticket_email, :param_ticket_subject, :param_ticket_message)");
$mysql_query->bindParam(':param_ticket_name', $ticket_name, PDO::PARAM_STR);
$mysql_query->bindParam(':param_ticket_email', $ticket_email, PDO::PARAM_STR);
$mysql_query->bindParam(':param_ticket_subject', $ticket_subject, PDO::PARAM_STR);
$mysql_query->bindParam(':param_ticket_message', $ticket_message, PDO::PARAM_STR);

$mysql_query->execute();



Thanks,
Jassim[^]


Technology News @ www.JassimRahma.com

AnswerRe: returning record identity using PDO Pin
Eddy Vluggen7-Oct-13 7:21
professionalEddy Vluggen7-Oct-13 7:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.