close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Delete Behaviour

Thread began 4/08/2010 8:11 am by John Langer | Last modified 4/08/2010 5:07 pm by John Langer | 2248 views | 6 replies

John LangerBeta Tester

Delete Behaviour

I'm having trouble deleting a record. The database structure is unusual in as much as I have the ID and the field showing the same information.

serviceID servicename
Morning Morning
Evening Evening
South Green South Green

Now this works fine as long as there is not a space in the serviceID column. So it will delete Evening and Morning but NOT South Green.

This is the PHP code

// WA Application Builder Delete
if (isset($_POST["Delete_x"])) // Trigger
$WA_connection $localhost;
$WA_table "bbc_service";
$WA_redirectURL "bbc_service_Results.php";
$WA_keepQueryString false;
$WA_fieldNamesStr "serviceID";
$WA_columnTypesStr "',none,''";
$WA_fieldValuesStr "".((isset($_POST["WADADeleteRecordID"]))?$_POST["WADADeleteRecordID"]:"")  ."";
$WA_comparisonStr "=";
$WA_fieldNames explode("|"$WA_fieldNamesStr);
$WA_fieldValues explode("|"$WA_fieldValuesStr);
$WA_columns explode("|"$WA_columnTypesStr);
$WA_comparisions explode("|"$WA_comparisonStr);
$WA_connectionDB $database_localhost;
  if (!
session_id()) session_start();
$deleteParamsObj WA_AB_generateWhereClause($WA_fieldNames$WA_columns$WA_fieldValues$WA_comparisions);
$WA_Sql "DELETE FROM `" $WA_table "` WHERE " $deleteParamsObj->sqlWhereClause;
$MM_editCmd mysql_query($WA_Sql$WA_connection) or die(mysql_error());
  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);

Is there anything I can add / alter to that code that will allow the deletion of a record that has a space in the ID?

I know that this was probably bad design when I did this (about a year ago now) but it seemed a good idea at the time. If I was to change the ID to a numeric value now it would involve changing an awful lot of pages else where in the site that uses the data. So If there is a simple solution I'd be grateful to know it. Like adding an underscore if there is a space for example. The code is beyond my level of expertise I'm afraid.

Many thanks.

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