close ad
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Find Session Variable?

Thread began 2/10/2011 9:52 am by willo009412397 | Last modified 2/23/2011 1:24 pm by willo009412397 | 3866 views | 18 replies


Hi Jason
Ok all week i have been on a Foreign Key mission, as i did not even know i needed one or know what one was lol. Thanks for putting me on the right track, i have the Database setup with a Relationship between the 2 tables. The relationship is between:

CustomerData (table1)
CustomerID- int(11)- Null=No- Default=None- Auto Increment

PetData (table2)
PetID- int(11)- Null=No- Default=None- Auto Increment
FKey- int(11)- Null=No- Default=None (this is the foreign key set as)
`petseen`.`customerdata`.`CustomerID`. CASCADE-CASCADE

On my Insert-Page i have binded the FKey to (CustomerID) in the parent table. But its not working i have been on a Mysql Forum and had guidence there that the Database structure is right. The only thing anyone could see was within the InsertPage code shown below:

<?php require_once('../Connections/petsCon.php'); ?>
<?php require_once("../WA_DataAssist/WA_AppBuilder_PHP.php"); ?>
// WA Application Builder Insert
if (isset($_POST["Insert_x"])) // Trigger
$WA_connection = $petsCon;
$WA_table = "petdata";
$WA_sessionName = "WADA_Insert_petdata";
$WA_redirectURL = "petdata_Results.php";
if (function_exists("rel2abs")) $WA_redirectURL = $WA_redirectURL?rel2abs($WA_redirectURL,dirname(__FILE__)):"";
$WA_keepQueryString = false;
$WA_indexField = "PetID";
$WA_fieldNamesStr = "Fkey|Type|Breed|Age|Colour|Price|SalesPoint|Description|Image1|Image2|VideoClip";
$WA_fieldValuesStr = "".$_SESSION['CustomerID'] ."" . "|" . "".((isset($_POST["Type"]))?$_POST["Type"]:"") ."" . "|" . "".((isset($_POST["Breed"]))?$_POST["Breed"]:"") ."" . "|" . "".((isset($_POST["Age"]))?$_POST["Age"]:"") ."" . "|" . "".((isset($_POST["Colour"]))?$_POST["Colour"]:"") ."" . "|" . "".((isset($_POST["Price"]))?$_POST["Price"]:"") ."" . "|" . "".((isset($_POST["SalesPoint"]))?$_POST["SalesPoint"]:"") ."" . "|" . "".((isset($_POST["Description"]))?$_POST["Description"]:"") ."" . "|" . "".((isset($_POST["Image1"]))?$_POST["Image1"]:"") ."" . "|" . "".((isset($_POST["Image2"]))?$_POST["Image2"]:"") ."" . "|" . "".((isset($_POST["VideoClip"]))?$_POST["VideoClip"]:"") ."";
$WA_columnTypesStr = "none,none,NULL|',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_petsCon;
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);

Only thing anyone could find was here - if (!session_id()) session_start(); i was advised that the session_start(); part should be at the top of page?I have not tried it , i thought best to ask here 1st.

When i try to insert a record i get this error--Column 'Fkey' cannot be null

thankyou for anyhelp

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





Ease of use


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...