close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 or 2018 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Single record insert will not create session variable

Thread began 1/12/2010 12:16 am by info298025 | Last modified 3/15/2010 6:07 pm by Jason Byrnes | 840 views | 4 replies |

info298025

Single record insert will not create session variable

I have been trying for 5 hours to get Single record insert to create the session variable so I can filter the database and email the result from the success page. it's not working

Everything on the page is inserting correctly and the uploading (2 files) correctly but it will not create a session variable.

DW CS3 latest ver of data assist

<?php
// WA Application Builder Insert
if ($_SERVER["REQUEST_METHOD"] == "POST") // Trigger
{
$WA_connection = $daves;
$WA_table = "estimates";
$WA_sessionName = "estimates_estimates_id";
$WA_redirectURL = "success.php";
$WA_keepQueryString = false;
$WA_indexField = "estimates_id";
$WA_fieldNamesStr = "estimates_first_name|estimates_last_name|estimates_address|estimates_city|estimates_state|estimates_zip|estimates_phone|estimates_email|estimates_model|estimates_make|estimates_year|estimates_desc|estimates_pic_1|estimate_pic_1_thumb|estimates_pic_2|estimate_pic_2_thumb";
$WA_fieldValuesStr = "".((isset($_POST["estimates_first_name"]))?$_POST["estimates_first_name"]:"") ."" . "|" . "".((isset($_POST["estimates_last_name"]))?$_POST["estimates_last_name"]:"") ."" . "|" . "".((isset($_POST["estimates_address"]))?$_POST["estimates_address"]:"") ."" . "|" . "".((isset($_POST["estimates_city"]))?$_POST["estimates_city"]:"") ."" . "|" . "".((isset($_POST["estimates_state"]))?$_POST["estimates_state"]:"") ."" . "|" . "".((isset($_POST["estimates_zip"]))?$_POST["estimates_zip"]:"") ."" . "|" . "".((isset($_POST["estimates_phone"]))?$_POST["estimates_phone"]:"") ."" . "|" . "".((isset($_POST["estimates_email"]))?$_POST["estimates_email"]:"") ."" . "|" . "".((isset($_POST["esitmates_model"]))?$_POST["esitmates_model"]:"") ."" . "|" . "".((isset($_POST["estimates_make"]))?$_POST["estimates_make"]:"") ."" . "|" . "".((isset($_POST["estimates_year"]))?$_POST["estimates_year"]:"") ."" . "|" . "".((isset($_POST["estimates_damage_desc"]))?$_POST["estimates_damage_desc"]:"") ."" . "|" . "".$WA_DFP_UploadStatus["WA_UploadResult1"]["WA_UploadResult1_1"]["serverFileName"] ."" . "|" . "".$WA_DFP_UploadStatus["WA_UploadResult1"]["WA_UploadResult1_2"]["serverFileName"] ."" . "|" . "".$WA_DFP_UploadStatus["WA_UploadResult2"]["WA_UploadResult2_1"]["serverFileName"] ."" . "|" . "".$WA_DFP_UploadStatus["WA_UploadResult2"]["WA_UploadResult2_2"]["serverFileName"] ."";
$WA_columnTypesStr = "',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''";
$WA_fieldNames = explode("|", $WA_fieldNamesStr);
$WA_fieldValues = explode("|", $WA_fieldValuesStr);
$WA_columns = explode("|", $WA_columnTypesStr);
$WA_connectionDB = $database_daves;
mysql_select_db($WA_connectionDB, $WA_connection);
if (!session_id()) session_start();
$insertParamsObj = WA_AB_generateInsertParams($WA_fieldNames, $WA_columns, $WA_fieldValues, -1);
$WA_Sql = "INSERT INTO `" . $WA_table . "` (" . $insertParamsObj->WA_tableValues . ") VALUES (" . $insertParamsObj->WA_dbValues . ")";
$MM_editCmd = mysql_query($WA_Sql, $WA_connection) or die(mysql_error());
$_SESSION[$WA_sessionName] = mysql_insert_id();
if ($WA_redirectURL != "") {
if ($WA_keepQueryString && $WA_redirectURL != "" && isset($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] !== "" && sizeof($_POST) > 0) {
$WA_redirectURL .= ((strpos($WA_redirectURL, '?') === false)?"?":"&").$_SERVER["QUERY_STRING"];
}
header("Location: ".$WA_redirectURL);
}
}
?>

Sign in to reply to this post

Jason ByrnesWebAssist

your code will create a session variable named "estimates_estimates_id":

$WA_sessionName = "estimates_estimates_id";


Try adding the following at line 1 of the success page:

php:
<?php if(!session_id()) session_start(); ?>



if it is still not working, add the following after the body tag to display all sessions that are set:

php:
<pre><?php var_dump($_SESSION); ?></pre>



check to see if the estimates_estimates_id variable is listed in the session dump.

If it is not, there may be a problem on the server. I am attaching a sessionTest.php file to this message, upload it to the server to test the servers session management abilities. If it fails the test, you will need to contact the host, if it passes, add your insert page and the success page to a zip file and send that with your reply.

Attached Files
sessionTest.zip
Sign in to reply to this post

info298025

<?php if(!session_id()) session_start(); ?>



Placing this on my success page worked thanks

Sign in to reply to this post

dlovas275157

I had the same problem while I was developing on a PHP4 server. As soon as I switched to a PHP5 server, my server stored the session variables properly and the redirect to the detai. page worked.

Scripts must be written for PHP5 only.

Maybe this will help someone else.

D.

Sign in to reply to this post

Jason ByrnesWebAssist

most of our extensions write PHP 4 and 5 compatibel code.


In the case of session variables, there are a number of php bugs that can be encountered.


PHP can often forget about the browsing session. Adding:

php:
<?php if(!session_id()) session_start(); ?>



will for ce php to look for the session. This can happen in both php 4 and php 5

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...