close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Multiple Record Insert...

Thread began 6/06/2011 1:23 pm by Jim E D | Last modified 6/07/2011 8:50 am by Jason Byrnes | 1037 views | 3 replies |

Jim E D

Multiple Record Insert...

I need to link in a number of "categories" to my main table.

In the attached page I've just added my second single recordset (sponsor) to the file. The first two insert fine, but I get no inserts for the Sponsor.

What am I missing?

Thanks again

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

Jason ByrnesWebAssist

the code at line 46 - 103 has the sponsor being inserted before the marker is created

php:
<?php 

// WA Application Builder Insert
if (isset($_POST["Insert"])) // Trigger
{
  
$WA_connection $HARS;
  
$WA_table "markersponsormrt";
  
$WA_sessionName "markersponsormrt_MrkrSpon_ID";
  
$WA_indexField "MrkrSpon_ID";
  
$WA_fieldNamesStr "MarkerID|SponsorID";
  
$WA_fieldValuesStr "".$_SESSION['WADA_Insert_markers']  ."" "|" "".((isset($_POST["getSponsor"]))?$_POST["getSponsor"]:"")  ."";
  
$WA_columnTypesStr "none,none,NULL|none,none,NULL";
  
$WA_fieldNames explode("|"$WA_fieldNamesStr);
  
$WA_fieldValues explode("|"$WA_fieldValuesStr);
  
$WA_columns explode("|"$WA_columnTypesStr);
  
$WA_connectionDB $database_HARS;
  
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);
  }
}
?>
<?php
 
// WA Application Builder Insert
if (isset($_POST["Insert"])) // Trigger
{
  
$WA_connection $HARS;
  
$WA_table "markers";
  
$WA_sessionName "WADA_Insert_markers";
  
$WA_indexField "MarkerID";
  
$WA_fieldNamesStr "MarkerNumber|MarkerName|MarkerCirca|MarkerAddress|MarkerCity|MarkerState|MarkerZip|MarkerLat|MarkerLong|MarkerTourDesc|MarkerShortDesc|MarkerLongDesc|MarkerThumb|MarkerImage|MarkerFeature|MarkerLive|MarkerComment|MarkerSponsor|MarkerUserID|MarkerUserIDUpdate|MarkerOriginationDate|MarkerUpdateDate";
  
$WA_fieldValuesStr "".((isset($_POST["MarkerNumber"]))?$_POST["MarkerNumber"]:"")  ."" "|" "".((isset($_POST["MarkerName"]))?$_POST["MarkerName"]:"")  ."" "|" "".((isset($_POST["MarkerCirca"]))?$_POST["MarkerCirca"]:"")  ."" "|" "".((isset($_POST["MarkerAddress"]))?$_POST["MarkerAddress"]:"")  ."" "|" "".((isset($_POST["MarkerCity"]))?$_POST["MarkerCity"]:"")  ."" "|" "".((isset($_POST["MarkerState"]))?$_POST["MarkerState"]:"")  ."" "|" "".((isset($_POST["MarkerZip"]))?$_POST["MarkerZip"]:"")  ."" "|" "".((isset($_POST["MarkerLat"]))?$_POST["MarkerLat"]:"")  ."" "|" "".((isset($_POST["MarkerLong"]))?$_POST["MarkerLong"]:"")  ."" "|" "".((isset($_POST["MarkerTourDesc"]))?$_POST["MarkerTourDesc"]:"")  ."" "|" "".((isset($_POST["MarkerShortDesc"]))?$_POST["MarkerShortDesc"]:"")  ."" "|" "".((isset($_POST["MarkerLongDesc"]))?$_POST["MarkerLongDesc"]:"")  ."" "|" "".((isset($_POST["MarkerThumb"]))?$_POST["MarkerThumb"]:"")  ."" "|" "".((isset($_POST["MarkerImage"]))?$_POST["MarkerImage"]:"")  ."" "|" "".((isset($_POST["MarkerFeature"]))?$_POST["MarkerFeature"]:"")  ."" "|" "".((isset($_POST["MarkerLive"]))?$_POST["MarkerLive"]:"")  ."" "|" "".((isset($_POST["MarkerComment"]))?$_POST["MarkerComment"]:"")  ."" "|" "".((isset($_POST["MarkerSponsor"]))?$_POST["MarkerSponsor"]:"")  ."" "|" "".((isset($_POST["MarkerUserID"]))?$_POST["MarkerUserID"]:"")  ."" "|" "".((isset($_POST["MarkerUserIDUpdate"]))?$_POST["MarkerUserIDUpdate"]:"")  ."" "|" "".((isset($_POST["MarkerOriginationDate"]))?$_POST["MarkerOriginationDate"]:"")  ."" "|" "".((isset($_POST["MarkerUpdateDate"]))?$_POST["MarkerUpdateDate"]:"")  ."";
  
$WA_columnTypesStr "',none,''|',none,''|none,none,NULL|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|none,none,NULL|none,none,NULL|',none,''|',none,''|none,none,NULL|none,none,NULL|',none,NULL|',none,NULL";
  
$WA_fieldNames explode("|"$WA_fieldNamesStr);
  
$WA_fieldValues explode("|"$WA_fieldValuesStr);
  
$WA_columns explode("|"$WA_columnTypesStr);
  
$WA_connectionDB $database_HARS;
  
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);
  }
}
?>




these two code blocks need to be switched so the marker is inserted before the sponsor.

Sign in to reply to this post

Jim E D

Got it...

Thanks Jason, that's where DA put the code. So am I to assume it will always place this code at the top and I'll need to adapt?

Is there a document/tutorial for placing multiple inserts in a page that I'm missing?

Sign in to reply to this post

Jason ByrnesWebAssist

it should order the inserts in the same way you add them to the page.

If you add the insert record behavior for the markers table to the page first, then add the insert for the sponsor, that is the order they should be in the code.


Dreamweaver implements a "Weighting" system that is used by DA to determine Server Behavior order, sometimes the Dreamweaver weighting system can go a bit off though.

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