Reply to Problems getting the last inserted ID

Your name:

Reply:


Posted by Jeff on 01/22/07 19:01

Hey

I use php 5.2.0 and via this php code I call a stored procedure (see the
code below):

This stored procedure inserts a new record into table (mysql5 database). The
problem is that $db->insert_id don't give the id of the newly inserted
record in the table, it gives the value 0

This is the declaration of the primary key column on this table
Id int unsigned not null auto_increment primary key

$sql = "call SaveProperty(".$_SESSION['userId'].", '".$adresse."')";
echo $sql;
$result = $db->query($sql);
echo "NEW ID = ".$db->insert_id;
if (mysqli_errno($db))
{
$error = mysqli_error($db);
echo $error;
}

Any suggestions?

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация