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

Check Unique Key

Thread began 5/20/2010 12:28 pm by victor278184 | Last modified 5/21/2010 2:45 pm by victor278184 | 860 views | 5 replies |

victor278184

Check Unique Key

Sorry, if i ask too much... :D... i'm converting my next admin from ADDT to Data Assist (well..i really hope your PHP Framework will release soon)

i would like to know on how to reject duplicate record.. for example like username or email... in ADDT, there is a 'trigger' which in Developer Toolbox > Form Validation > Check Unique Key..

how to apply in data assist ? i try with WA validation toolkit .. but coudn't find it.. as well

Sign in to reply to this post

Eric Mittman

This type of trigger is not a feature of DataAssist. To check for a duplicate value you will need to manually implement the check. This will consist of having an additional recordset on the page that search in the table for a record where the specified column matches the posted value from the form.

Once you have the recordset in place you can add in a numeric validation based on the total rows variable for that recordset. If this value is greater than 0 then there was a match and the record is a duplicate one. If it is 0 or less then there are no matches and you should proceed with inserting the record.

Sign in to reply to this post

Miguel

the record set should look something like this


$colname_userexist = "-1";
if (isset($_POST['UserEmail'])) {
$colname_userexist = (get_magic_quotes_gpc()) ? $_POST['UserEmail'] : addslashes($_POST['UserEmail']);
}
mysql_select_db($database_MYDB, $MYDB);
$query_userexist = sprintf("SELECT UserID, UserEmail FROM User_db WHERE UserEmail = %s", GetSQLValueString($colname_userexist, "text"));
$userexist = mysql_query($query_userexist, $sofiaslu) or die(mysql_error());
$row_userexist = mysql_fetch_assoc($userexist);
$totalRows_userexist = mysql_num_rows($userexist);



in other words you add a new recordset the normal way dreamweaver adds them and on filter select the field you want to check for unique names, select from Form Field, and on the next box the value of it then you will need to use the Validation toolkit server side.



With validation toolkit you can add the total row count for that query, $totalRows_userexist and select validation type: Number




When you insert it it will ask you the number values, the Format should be international it didnt work for me with the other formats, then on minimum put -1 and maximum 0, uncheck allow blank if its checked, click ok and add your msg



Hope this helps i miss the easy ways to do stuff also with addt some things with webassist take a lot more time consuming but you can control a bit more how things should be.

Sign in to reply to this post

victor278184

Thanks for the reply, so i have to manage the source code as well since i have to put the chunk of codes from validation process above the insert record, right ?

Sign in to reply to this post

Miguel

Yes you have to move the validation code above the insert in order it to trigger the validation before inserting, from my experince with dataaasist and validation toolkit, they work very bad when working with templates, when i work with a template and asign any page it some times adds things in the wrong order, at the end i have to move stuffs around to the correct parts

Sign in to reply to this post

victor278184

this is place where webassist team can adapt what addt could do.... transaction-trigger concept... interakt give the api documentation which webassist team could `steal`

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