Jump to content

Wondering if this would work....


nine72

Recommended Posts

Hi everyone,

 

Just a question if you will...

 

I have a set of forms (8 to be exact) I am saving the field data to the session, then generating a massive, very complex XML string based on the data in the session.

EXP...for simplest part of the xml build.

$xmlString .= "<Corporate>\n";
		$xmlString .= "<CpBus>\n";
			$xmlString .= "<agent_id>". $agentId ."</agent_id>\n";
			$xmlString .= "<iso_id>". $isoId . "</iso_id>\n";
			$xmlString .= "<bb_id>". $bbId . "</bb_id>\n";
			$xmlString .= "<cp_legal_name>". $cpLegalName . "</cp_legal_name>\n";
			$xmlString .= "<cp_dba_name>". $cpDbaName . "</cp_dba_name>\n";
		$xmlString .= "</CpBus>\n";
	$xmlString .= "</Corporate>\n";

 

Moving forward I do not want to save to the session as I need 3 of the forms to be able to be used over and over by the user as many times as needed. Therefore, I am now committing the data to a mysql temp db. At the point I want to build my XML string I want to pull the information from the tables and place into a session, just long enough to build the string. The session build needs to look something like this:

 

 
$_SESSION['column_name'] = $val_of_cell;

 

So I am thinking that it should be as simple as...

 
include_once("../../Connections/bdadd.php"); // Location of my db connection script
include_once("../../db_calls/get_session.php"); // Location of my query to get table data. $xmlSet = 'SELECT * FROM table_name'

$query = ($xmlSet);  
$res = mysql_query($query);  
if($res){  
    while($row = mysql_fetch_assoc($res)){  
    foreach($row as $key => $val){  
    $_SESSION[$key] = ($val);            
    }  
    }  
}

 

Change to the xml generation would be something like…

 

	$xmlString .= "<Corporate>\n";
		$xmlString .= "<CpBus>\n";
			$xmlString .= "<agent_id>". $agentId ."</agent_id>\n";
			$xmlString .= "<iso_id>". $isoId . "</iso_id>\n";
			$xmlString .= "<bb_id>". $bbId . "</bb_id>\n";
			$xmlString .= "<cp_legal_name>". $cpLegalName . "</cp_legal_name>\n";
			$xmlString .= "<cp_dba_name>". $cpDbaName . "</cp_dba_name>\n";
		$xmlString .= "</CpBus>\n";
	$xmlString .= "</Corporate>\n";

 

To accommodate the session set up.

 

However, when I try and test this theory by doing a

 	echo "<pre>";
		print_r(session_id());
		print_r("\n");
		print_r($_SESSION);
	echo "</pre>";	

 

I get the session_id but none of the data from the table....

 

Does anyone have any thoughts, theories or suggestions?

 

Thanks

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.