Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

OT: Maximum value?

LEGEND ,
Oct 20, 2006 Oct 20, 2006
Why is this markup not producing the desired value? Instead I get 'Resource
id #3'....

mysql_select_db($database_selectData, $selectData);
$UserQuery = 'SELECT MAX(contactRecord) FROM tblcontactdata';
$UserNum = mysql_query($UserQuery, $selectData) or die(mysql_error());
echo($UserNum);

I am wanting to determine the recordID of the person who just registered!

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================



TOPICS
Server side applications
404
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 20, 2006 Oct 20, 2006
On Fri, 20 Oct 2006 10:15:06 -0400, "Murray *ACE*"
<forums@HAHAgreat-web-sights.com> wrote:

>I am wanting to determine the recordID of the person who just registered!

To get the ID generated from the previous insert code you can use
mysql_insert_id

Example:

<?php
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
mysql_select_db('mydb');

mysql_query("INSERT INTO mytable (product) values ('kossu')");
printf("Last inserted record has id %d\n", mysql_insert_id());
?>

which is lifted from:

http://hk2.php.net/mysql_insert_id

HTH
--
Steve
steve at flyingtigerwebdesign dot com
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 20, 2006 Oct 20, 2006
Thank you! Works good.

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================


"Steve" <me@here.com> wrote in message
news:rmnhj211qnqegpk72dkn1km39o1455nb2q@4ax.com...
> On Fri, 20 Oct 2006 10:15:06 -0400, "Murray *ACE*"
> <forums@HAHAgreat-web-sights.com> wrote:
>
>>I am wanting to determine the recordID of the person who just registered!
>
> To get the ID generated from the previous insert code you can use
> mysql_insert_id
>
> Example:
>
> <?php
> $link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
> if (!$link) {
> die('Could not connect: ' . mysql_error());
> }
> mysql_select_db('mydb');
>
> mysql_query("INSERT INTO mytable (product) values ('kossu')");
> printf("Last inserted record has id %d\n", mysql_insert_id());
> ?>
>
> which is lifted from:
>
> http://hk2.php.net/mysql_insert_id
>
> HTH
> --
> Steve
> steve at flyingtigerwebdesign dot com


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 20, 2006 Oct 20, 2006
.oO(Steve)

>On Fri, 20 Oct 2006 10:15:06 -0400, "Murray *ACE*"
><forums@HAHAgreat-web-sights.com> wrote:
>
>>I am wanting to determine the recordID of the person who just registered!
>
>To get the ID generated from the previous insert code you can use
>mysql_insert_id
>[...]

Yep, that's the correct way.

And to give a reason for the result Murray got:

mysql_query() returns just a resource ID, which is kind of a "pointer"
to the actual result set. Having this ID you can use the different
mysql_fetch_*() functions to get the rows from the result set.

Or use the PDO extension if available on your server.

Mi'back on stage'cha
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 20, 2006 Oct 20, 2006
good stuff Maynard!!!

> And to give a reason for the result Murray got:
>
> mysql_query() returns just a resource ID, which is kind of a "pointer"
> to the actual result set. Having this ID you can use the different
> mysql_fetch_*() functions to get the rows from the result set.
>
> Or use the PDO extension if available on your server.
>
> Mi'back on stage'cha


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 20, 2006 Oct 20, 2006
On 20 Oct 2006 in macromedia.dreamweaver.appdev, Michael Fesser wrote:

> Yep, that's the correct way.

Micha! Nice to see you ducking back in!

--
Joe Makowiec
http://makowiec.net/
Email: http://makowiec.net/email.php
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 20, 2006 Oct 20, 2006
Welcome back, Micha! Where you been?

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================


"Michael Fesser" <netizen@gmx.de> wrote in message
news:c04ij298ergs780obeo0g0m1fg3k062f88@4ax.com...
> .oO(Steve)
>
>>On Fri, 20 Oct 2006 10:15:06 -0400, "Murray *ACE*"
>><forums@HAHAgreat-web-sights.com> wrote:
>>
>>>I am wanting to determine the recordID of the person who just registered!
>>
>>To get the ID generated from the previous insert code you can use
>>mysql_insert_id
>>[...]
>
> Yep, that's the correct way.
>
> And to give a reason for the result Murray got:
>
> mysql_query() returns just a resource ID, which is kind of a "pointer"
> to the actual result set. Having this ID you can use the different
> mysql_fetch_*() functions to get the rows from the result set.
>
> Or use the PDO extension if available on your server.
>
> Mi'back on stage'cha


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 20, 2006 Oct 20, 2006
.oO(Murray *ACE*)

>Welcome back, Micha! Where you been?

Long, sad story. Some technical problems and a lot of personal sorrows.
But I'm fine.

Micha
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 20, 2006 Oct 20, 2006
Sorry to hear that and glad you're back.

Jon

"Michael Fesser" <netizen@gmx.de> wrote in message
news:pt7ij2t67nmavb9spd1c7s480plj39h8qs@4ax.com...
> .oO(Murray *ACE*)
>
>>Welcome back, Micha! Where you been?
>
> Long, sad story. Some technical problems and a lot of personal sorrows.
> But I'm fine.
>
> Micha


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 20, 2006 Oct 20, 2006
We missed your grouchy self....

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================


"Michael Fesser" <netizen@gmx.de> wrote in message
news:pt7ij2t67nmavb9spd1c7s480plj39h8qs@4ax.com...
> .oO(Murray *ACE*)
>
>>Welcome back, Micha! Where you been?
>
> Long, sad story. Some technical problems and a lot of personal sorrows.
> But I'm fine.
>
> Micha


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 20, 2006 Oct 20, 2006
.oO(Murray *ACE*)

>We missed your grouchy self....

;)

Micha
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 20, 2006 Oct 20, 2006
LATEST
Michael Fesser wrote:
> .oO(Murray *ACE*)
>
>>We missed your grouchy self....
>
> ;)

Micha grouchy? Surely some mistake. ;-p

--
David Powers
Adobe Community Expert
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
http://foundationphp.com/
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines