CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 CCSetSession

Print topic Send  topic

Author Message
MichaelMcDonald

Posts: 640
Posted: 05/26/2009, 2:13 AM

My goal is to create a session variable (using the internet store example) and to achieve this I have added the line:-
CCSetSession("order_id", $db->f("order_id"));

as follows:

//Specify the custom method for the database.
$SQL = "SELECT MAX(order_id) FROM store_orders";
CCSetSession("order_id", $db->f("order_id"));
$db->query($SQL);
if ($db->next_record()) {
$last_order_id = $db->f(0);
}

The page loads OK, however when I attempt to retrieve this as a session variable it does not work.
_________________
Central Coast, NSW, Australia.

View profile  Send private message
damian

Posts: 838
Posted: 05/26/2009, 5:29 AM

are you sure its not setting the value?
maybe it just doesnt appear so?
to me it looks like you are setting the session too early....

_________________
if you found this post useful take the time to help someone else.... :)
View profile  Send private message
melvyn


Posts: 333
Posted: 05/26/2009, 7:48 AM

You're trying to set the session before querying the database. When you define $SQL =... nothing happen, the query is executed by $db->query(), so you need to ask the value after that.

Try the following:
  
//Specify the custom method for the database.  
$SQL = "SELECT MAX(order_id) FROM store_orders";  
$db->query($SQL);  
if ($db->next_record()) {  
$last_order_id = $db->f(0);  
CCSetSession("order_id", $last_order_id);   
// Also can try: CCSetSession("order_id", $db->f['order_id']);  
}  

M.
_________________
Melvyn Perez
Puro Codigo
http://purocodigo.com
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.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


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