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

How to check two unique value in the same record of the database?

Thread began 9/10/2018 11:45 am by tony | Last modified 10/17/2018 11:47 am by tony | 136 views | 11 replies

tony

Hi Ray,
sorry to re-open this thread, but I upgraded the page to DataBridge 2 and I have a little problem:
the problem is still this: trying to block users that enter the same data more than a time ("unique database value" sort of, but checking 4 fields).
So, I entered the WA server validation sb and it has been automatically updated.
See attachment 1.

But validation pass even if I insert the same data.

Here is the recordset I would like to use and check:

<?php
$rs_doppioni = new WA_MySQLi_RS("rs_doppioni",$conn_registrazione_i,1);
$rs_doppioni->setQuery("SELECT * FROM registrazioni WHERE registrazioni.ora_scontrino_reg = ? AND registrazioni.data_scontrino_reg = ? AND registrazioni.minuti_scontrino_reg = ? AND registrazioni.numero_scontrino_reg = ?");
$rs_doppioni->bindParam("s", "".((isset($_POST["ora_scontrino_reg"]))?$_POST["ora_scontrino_reg"]:"") ."", "-1"); //orascontrino
$rs_doppioni->bindParam("s", "".((isset($_POST["data_scontrino_reg"]))?$_POST["data_scontrino_reg"]:"") ."", "-1"); //datascontrino
$rs_doppioni->bindParam("s", "".((isset($_POST["minuti_scontrino_reg"]))?$_POST["minuti_scontrino_reg"]:"") ."", "-1"); //minutiscontrino
$rs_doppioni->bindParam("s", "".((isset($_POST["numero_scontrino_reg"]))?$_POST["numero_scontrino_reg"]:"") ."", "-1"); //numeroscontrino
$rs_doppioni->execute();
?>



I tried the code above but it always validate.
So I made the same changes I made in databsridge 1:

<?php
$rs_doppioni = new WA_MySQLi_RS("rs_doppioni",$conn_registrazione_i,1);
$rs_doppioni->setQuery("SELECT * FROM registrazioni WHERE registrazioni.ora_scontrino_reg = ? AND registrazioni.data_scontrino_reg = ? AND registrazioni.minuti_scontrino_reg = ? AND registrazioni.numero_scontrino_reg = ?");
$rs_doppioni->bindParam("s", "".((isset($_POST["ora_scontrino_reg"]))?$_POST["ora_scontrino_reg"]:"") ."", "-1"); //orascontrino
$rs_doppioni->bindParam("s", "".((isset(date('Y-m-d',strtotime(str_replace("/","-",$_POST["data_scontrino_reg"])))))?date('Y-m-d',strtotime(str_replace("/","-",$_POST["data_scontrino_reg"]))):"") ."", "-1"); //datascontrino
$rs_doppioni->bindParam("s", "".((isset($_POST["minuti_scontrino_reg"]))?$_POST["minuti_scontrino_reg"]:"") ."", "-1"); //minutiscontrino
$rs_doppioni->bindParam("s", "".((isset($_POST["numero_scontrino_reg"]))?$_POST["numero_scontrino_reg"]:"") ."", "-1"); //numeroscontrino
$rs_doppioni->execute();
?>



It still validate even if I insert the same data.

I have already tried to remove the DATE field, but validation pass too...


Is this right or I need to use another method in DB2?

TIA
tony

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