Skip to main content
Inspiring
October 20, 2006
Question

OT: Maximum value?

  • October 20, 2006
  • 11 replies
  • 420 views
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
==================



This topic is closed to new replies. Start a new post to keep the conversation going.

11 replies

Inspiring
October 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