Click here to Skip to main content
15,902,189 members
Home / Discussions / Database
   

Database

 
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 
AnswerRe: returning record identity using PDO Pin
Eddy Vluggen7-Oct-13 7:21
professionalEddy Vluggen7-Oct-13 7:21 
GeneralRe: returning record identity using PDO Pin
Jassim Rahma7-Oct-13 7:46
Jassim Rahma7-Oct-13 7:46 
GeneralRe: returning record identity using PDO Pin
Eddy Vluggen7-Oct-13 11:51
professionalEddy Vluggen7-Oct-13 11:51 
QuestionlastInsertId() returns ZERO Pin
Jassim Rahma6-Oct-13 23:09
Jassim Rahma6-Oct-13 23:09 
Hi,

I am using PDO in MySQL to insert a ticket. I want to return the ticket number which is the primary key (auto increment) but it's always returning zero.

here is the code I am using:

PHP
$mysql_query = $mysql_connection->prepare("CALL sp_add_new_ticket(:param_ticket_name, :param_ticket_email, :param_ticket_subject, :param_ticket_message)");
// $mysql_connection->beginTransaction();
$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();

$ticket_number = $mysql_connection->lastInsertId();



Please help...


Jassim[^]


Technology News @ www.JassimRahma.com

AnswerRe: lastInsertId() returns ZERO Pin
jschell7-Oct-13 9:57
jschell7-Oct-13 9:57 
AnswerRe: lastInsertId() returns ZERO Pin
Amol_B10-Oct-13 23:59
professionalAmol_B10-Oct-13 23:59 
Questionoracle to sql server Pin
Sahar Hashemi4-Oct-13 21:16
Sahar Hashemi4-Oct-13 21:16 

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.