PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 12th, 2012, 07:44 PM
cdr6800 cdr6800 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2012
Posts: 16 cdr6800 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 4 m 22 sec
Reputation Power: 0
Value of MySql Database Field

Hello:
I have a MySql table with a field called MeetingNumber. It is the unique identifier (key) for the table so it adds the next number in sequence each time a record is added. I'm trying to print that value out in a confirmation email that gets sent and have used $MeetingNumber in the email. The email comes up blank though with that value. Any clues what I am doing wrong? The MeetingNumber value shows up in the database when I check it but does not show up in the email. Thanks for any help you can lend.

cdr6800

Reply With Quote
  #2  
Old October 12th, 2012, 07:56 PM
r937's Avatar
r937 r937 is offline
SQL Consultant
Click here for more information.
 
Join Date: Feb 2003
Location: Toronto Canada
Posts: 26,373 r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level) 
Time spent in forums: 3 Months 1 Week 2 Days 6 h 54 m 49 sec
Reputation Power: 4140
php? or some other language?

because you need to use php's mysql_insert_id() function to get the value of the auto_increment number that was assigned by the INSERT statement
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book

Reply With Quote
  #3  
Old October 12th, 2012, 08:00 PM
cdr6800 cdr6800 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2012
Posts: 16 cdr6800 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 4 m 22 sec
Reputation Power: 0
Quote:
Originally Posted by r937
php? or some other language?

because you need to use php's mysql_insert_id() function to get the value of the auto_increment number that was assigned by the INSERT statement


Hmmm..not sure I understand. Can you be more specific. Thanks for the reply.

Reply With Quote
  #4  
Old October 12th, 2012, 08:01 PM
cdr6800 cdr6800 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2012
Posts: 16 cdr6800 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 4 m 22 sec
Reputation Power: 0
Quote:
Originally Posted by r937
php? or some other language?

because you need to use php's mysql_insert_id() function to get the value of the auto_increment number that was assigned by the INSERT statement


Oh..sorry..by the way it is php.

Reply With Quote
  #5  
Old October 12th, 2012, 08:01 PM
cafelatte cafelatte is offline
Contributing User
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Mar 2008
Posts: 1,923 cafelatte User rank is Major (30000 - 40000 Reputation Level)cafelatte User rank is Major (30000 - 40000 Reputation Level)cafelatte User rank is Major (30000 - 40000 Reputation Level)cafelatte User rank is Major (30000 - 40000 Reputation Level)cafelatte User rank is Major (30000 - 40000 Reputation Level)cafelatte User rank is Major (30000 - 40000 Reputation Level)cafelatte User rank is Major (30000 - 40000 Reputation Level)cafelatte User rank is Major (30000 - 40000 Reputation Level)cafelatte User rank is Major (30000 - 40000 Reputation Level)cafelatte User rank is Major (30000 - 40000 Reputation Level) 
Time spent in forums: 1 Month 5 Days 16 h 21 m 8 sec
Reputation Power: 377
Note that these sorts of queries are actively discouraged now, in favour of their mysqli or PDO alternatives.

Reply With Quote
  #6  
Old October 12th, 2012, 08:09 PM
cdr6800 cdr6800 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2012
Posts: 16 cdr6800 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 4 m 22 sec
Reputation Power: 0
Maybe this will illustrate more clearly. I have this statement:

$query = "INSERT INTO AVorder VALUES ('$MeetingNumber','$Date','etc, etc, etc)

$MeetingNumber is the auto increment field. It is showingup in database, but not email. So could you explain how I would use the function you are referring to? Thanks.

cdr6800

Reply With Quote
  #7  
Old October 12th, 2012, 08:31 PM
TASB TASB is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2009
Posts: 148 TASB User rank is Second Lieutenant (5000 - 10000 Reputation Level)TASB User rank is Second Lieutenant (5000 - 10000 Reputation Level)TASB User rank is Second Lieutenant (5000 - 10000 Reputation Level)TASB User rank is Second Lieutenant (5000 - 10000 Reputation Level)TASB User rank is Second Lieutenant (5000 - 10000 Reputation Level)TASB User rank is Second Lieutenant (5000 - 10000 Reputation Level)TASB User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 4 Days 6 h 41 m 7 sec
Reputation Power: 88
You shouldn't be sending a value to an auto increment field when performing an insert.

You need to show the php code where you are generating the email. Your question would also be better targeted at the php forum.
Comments on this post
ptr2void agrees!

Reply With Quote
  #8  
Old October 12th, 2012, 08:36 PM
r937's Avatar
r937 r937 is offline
SQL Consultant
Click here for more information.
 
Join Date: Feb 2003
Location: Toronto Canada
Posts: 26,373 r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level) 
Time spent in forums: 3 Months 1 Week 2 Days 6 h 54 m 49 sec
Reputation Power: 4140
thread moved to php forum

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > Value of MySql Database Field

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap