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

rating

Delete web account

Thread began 4/30/2021 6:17 am by Jonas | Last modified 5/03/2021 3:35 pm by Ray Borduin | 72 views | 5 replies |

Jonas

Delete web account

I am creating a page where the user can choose to delete their entire user account.

The page first shows a summary of what will be deleted. When the user presses the delete button, a warning will appear in a "deleteBox" as usual. And when the user confirms this, the idea is that all data that the user has added to the database is deleted.

To do this, I think I have to:
#1, create multiple record sets that are linked to each table ID and filtered on SESSION ['SecurityAssist_UserID'].
#2, create the same number of hidden input fields, which are connected to each recordset.
#3, create delete record associated with each hidden input.

Since one of the tables contains data about uploaded images, I also have to use the "Delete File" function.

I have created this, but what happens is that only the first record from each recordset is deleted. I guess I need to create a repeat function, but how do I do this?

Sign in to reply to this post

Ray BorduinWebAssist

Usually you can set up the delete record server behavior to be based on the users ID and not use a separate recordset at all. The delete record server behavior will delete multiple records if you use a key that isn't unique like the userID.

So for instance... your first delete wouldn't be:
$DeleteQuery->Table = "bucGrade";
$DeleteQuery->addFilter("gra_ID", "=", "i", "".((isset($_POST["WADADeleteMygradesID"]))?$_POST["WADADeleteMygradesID"]:"") ."");

it would be:
$DeleteQuery->Table = "bucGrade";
$DeleteQuery->addFilter("gra_userID", "=", "i", "".($_SESSION['SecurityAssist_UserID']) ."");

Then you don't need any recordsets or hidden fields at all.

Sign in to reply to this post
Did this help? Tips are appreciated...

Jonas

Nice, it works now. All user data is deleted from all tables as you describe. Thanks!
But what do I do with images uploaded by the user. I want them to be deleted as well. When the images are uploaded, they are named as follows: bucID + userID, for example "buc-11_user-2.jpg". They are placed in two folders. One high resolution and one low resolution.

Sign in to reply to this post

Ray BorduinWebAssist

When I'm doing user specific files, I usually save them in a user specific folder, so they are easy to delete. In your case, you would probably want to use a recordset and loop through it deleting the images before deleting from the table.

Sign in to reply to this post
Did this help? Tips are appreciated...

Jonas

I have already done this recordset:
<?php
$rsDeleteMyimages = new WA_MySQLi_RS("rsDeleteMyimages",$bucketlistDB,0);
$rsDeleteMyimages->setQuery("SELECT bucImages.* FROM bucImages WHERE bucImages.ima_usrID = ?");
$rsDeleteMyimages->bindParam("i", "".$_SESSION['SecurityAssist_UserID'] ."", "-1"); //WAQB_Param1
$rsDeleteMyimages->execute();?>
But I don't know how to loop it?

Sign in to reply to this post

Ray BorduinWebAssist

Put a repeat region on the page for the recordset for all records... then just copy and paste it around the delete file code instead.

Sign in to reply to this post
Did this help? Tips are appreciated...

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