CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> Tips & Solutions

 Logical mistake in the store solution

Print topic Send  topic

Author Message
mkm

Posts: 10
Posted: 03/24/2012, 1:35 PM

Hi

Solution: Store, Page: Header, file: header_events.
After inserting new shoping_cart into DB, when the new cookie is created, the new cart id is taken using the SQL statement:
$SQL = "SELECT MAX(shopping_cart_id) FROM store_shopping_carts";
$db->query($SQL);
if($db->next_record()) {
$last_cart_id = $db->f(0);
}
It is possible to generate mistakes, because more than one person may make new shopping basket in the same time ...
The better option is to use PHP method:
$last_cart_id = mysql_insert_id();
thanks this you are sure of taking the proper ID because this method works in the current user session scope.

Regards

ProtonX
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright 2003-2004 by UltraApps.com  and YesSoftware, Inc.