I have my PHP inserting into Oracle 9i.
But how do I prevent duplicate record entries?
I only have 3 fields in the insert in the action page:
CODE
<?php
$c=OCILogon("sc ott", "tiger", "orcl");
if ( ! $c ) {
echo "Unable to connect: " . var_dump( OCIError() );
die();
}
$s = OCIParse($c, "INSERT INTO personTable
(firstname,last name,emailaddre ss) VALUES
($_POST[firstname],'$_POST[lastname]','$_POST[emailaddress]'");
OCIExecute($s, OCI_DEFAULT);
echo "Record successfully entered";
?>
How do I prevent duplicate record info and show the user they entered
duplicate info. 6 4541
<te****@hotmail .comwrote in message
news:37******** *************** ***********@i3g 2000hsf.googleg roups.com...
>I have my PHP inserting into Oracle 9i.
But how do I prevent duplicate record entries?
I only have 3 fields in the insert in the action page:
CODE
<?php
$c=OCILogon("sc ott", "tiger", "orcl");
if ( ! $c ) {
echo "Unable to connect: " . var_dump( OCIError() );
die();
}
$s = OCIParse($c, "INSERT INTO personTable
(firstname,last name,emailaddre ss) VALUES
($_POST[firstname],'$_POST[lastname]','$_POST[emailaddress]'");
OCIExecute($s, OCI_DEFAULT);
echo "Record successfully entered";
?>
How do I prevent duplicate record info and show the user they entered
duplicate info.
gee, you could just delete any record that may exist for that first/last
name and email address. or, you could query the table to see if the record
existed. this is not only such an RTFM question, it's also a brainless one.
and let me guess, you're the kind who's code is littered with meaningful
variables like $tmp...right?!! !
<te****@hotmail .comwrote in message
news:37******** *************** ***********@i3g 2000hsf.googleg roups.com...
>I have my PHP inserting into Oracle 9i.
But how do I prevent duplicate record entries?
I only have 3 fields in the insert in the action page:
CODE
<?php
$c=OCILogon("sc ott", "tiger", "orcl");
if ( ! $c ) {
echo "Unable to connect: " . var_dump( OCIError() );
die();
}
$s = OCIParse($c, "INSERT INTO personTable
(firstname,last name,emailaddre ss) VALUES
($_POST[firstname],'$_POST[lastname]','$_POST[emailaddress]'");
OCIExecute($s, OCI_DEFAULT);
echo "Record successfully entered";
?>
How do I prevent duplicate record info and show the user they entered
duplicate info.
In my opinion you should correctly use unique indexes on your table. That
way the query will return an error which you can then catch and return to
the user.
On Dec 21, 2:57*am, "tes...@hotmail .com" <tes...@hotmail .comwrote:
I have my PHP inserting into Oracle 9i.
But how do I prevent duplicate record entries?
I only have 3 fields in the insert in the action page:
CODE
<?php
$c=OCILogon("sc ott", "tiger", "orcl");
* if ( ! $c ) {
* * echo "Unable to connect: " . var_dump( OCIError() );
* * die();
* }
$s = OCIParse($c, "INSERT INTO personTable
(firstname,last name,emailaddre ss) VALUES
($_POST[firstname],'$_POST[lastname]','$_POST[emailaddress]'");
OCIExecute($s, OCI_DEFAULT);
echo "Record successfully entered";
?>
How do I prevent duplicate record info and show the user they entered
duplicate info.
You have to compare the entries considering the time, the remote
address and the values, if all the same (for time consider seconds
indeed) it will show a possible sql injection first entry must be
saved the other must be deleted.. Rest is few scripting.. ;)
"Betikci Boris" <pa*****@gmail. comwrote in message
news:c4******** *************** ***********@1g2 000hsl.googlegr oups.com...
On Dec 21, 2:57 am, "tes...@hotmail .com" <tes...@hotmail .comwrote:
I have my PHP inserting into Oracle 9i.
But how do I prevent duplicate record entries?
I only have 3 fields in the insert in the action page:
CODE
<?php
$c=OCILogon("sc ott", "tiger", "orcl");
if ( ! $c ) {
echo "Unable to connect: " . var_dump( OCIError() );
die();
}
$s = OCIParse($c, "INSERT INTO personTable
(firstname,last name,emailaddre ss) VALUES
($_POST[firstname],'$_POST[lastname]','$_POST[emailaddress]'");
OCIExecute($s, OCI_DEFAULT);
echo "Record successfully entered";
?>
How do I prevent duplicate record info and show the user they entered
duplicate info.
You have to compare the entries considering the time, the remote
address and the values, if all the same (for time consider seconds
indeed) it will show a possible sql injection first entry must be
saved the other must be deleted.. Rest is few scripting.. ;)
WHAT?!!!
time and remote address have *nothing* to do with duplicate entries, nor do
they have ANYTHING to do with sql injections!!!
Steve said:
"Betikci Boris" <pa*****@gmail. comwrote in message
news:c4******** *************** ***********@1g2 000hsl.googlegr oups.com...
On Dec 21, 2:57 am, "tes...@hotmail .com" <tes...@hotmail .comwrote:
>I have my PHP inserting into Oracle 9i. But how do I prevent duplicate record entries?
I only have 3 fields in the insert in the action page:
CODE <?php $c=OCILogon("s cott", "tiger", "orcl"); if ( ! $c ) { echo "Unable to connect: " . var_dump( OCIError() ); die(); }
$s = OCIParse($c, "INSERT INTO personTable (firstname,las tname,emailaddr ess) VALUES ($_POST[firstname],'$_POST[lastname]','$_POST[emailaddress]'"); OCIExecute($ s, OCI_DEFAULT); echo "Record successfully entered"; ?>
How do I prevent duplicate record info and show the user they entered duplicate info.
I'm no Oracle guru, but don't they have primary keys? Hell, if all you
want is to prevent dupes, make all three fields a combined key.
http://download-uk.oracle.com/docs/cd/B10501_01/server.920/a96524/c22integ.htm#19 75
Or you could do a select count(*) (However oracle phrases it) where the
fields match.
~A!
On Dec 21, 12:57 am, "tes...@hotmail .com" <tes...@hotmail .comwrote:
I have my PHP inserting into Oracle 9i.
But how do I prevent duplicate record entries?
I only have 3 fields in the insert in the action page:
CODE
<?php
$c=OCILogon("sc ott", "tiger", "orcl");
if ( ! $c ) {
echo "Unable to connect: " . var_dump( OCIError() );
die();
}
$s = OCIParse($c, "INSERT INTO personTable
(firstname,last name,emailaddre ss) VALUES
($_POST[firstname],'$_POST[lastname]','$_POST[emailaddress]'");
OCIExecute($s, OCI_DEFAULT);
echo "Record successfully entered";
?>
How do I prevent duplicate record info and show the user they entered
duplicate info.
Just put a unique first name/last name constraint on your table. Go to
an SQL related group to find out how, or better yet read the manual. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Catherine Jo Morgan |
last post by:
Can I set it up so that a certain combination of fields can't contain the
same entries, on another record? e.g. a combination of
FirstName/LastName/address? Or FirstName/LastName/phone? Or
FirstName/LastName/email?
Or is it possible to allow this but to throw up an alert message? Warning
that this person is probably already in the database? TIA
|
by: Manish |
last post by:
The topic is related to MySQL database.
Suppose a table "address" contains the following records
-------------------------------------------------------
| name | address | phone |
-------------------------------------------------------
| mr x | 8th lane | 124364 |
| mr x | 6th lane | 435783 |
| mrs x | 6th lane | 435783 |
|
by: Iona |
last post by:
Hi Allan,
I'm using a nifty piece of code you put on here some time back to do a
duplicate entry check as below. I'm using to check for duplicate names.
However I am getting an error message on this line: Set rs =
db.OpenRecordset("SELECT ID FROM Contacts WHERE (" & sWhere & ");")
Contacts being the main table. I am using access 2003
The error message states that there are; Too few parameters. Expected 1
I have no idea how to...
|
by: claus |
last post by:
Hi,
I am not a programmer but tries anyway to program a feature in a form
where I am able to copy entries for the form and a subform. I have
tried follow the guide here http://allenbrowne.com/ser-57.html, but my
problem is that I have more than one keyfield in the join between the
two tables: Hovedoplysninger and Itemoplysninger. The tree fields are:
"Medarbejder", "Sagsnummer" and "Mandag". I have succeded creating the
new entry...
|
by: baur79 |
last post by:
Hi guys
i try to run this code in loop and to pass even the entry is
duplicated
def email_insert_in_db(email):
sql="INSERT INTO emails (email) values ('%s') "%(email)
db=_mysql.connect(host = "localhost", user = db_user, passwd =
db_pass, db = db_name)
| |
by: eazyone |
last post by:
I can prevent a duplicate ID from being entered, but can't figure out how to go to that specific record. I keep getting an error message on:
Me.Bookmark = rsc.Bookmark
Its not opening and displaying the duplicate record, can anyone help?
Here's a snipet of the code for before Update
Private Sub RegNumber_BeforeUpdate(Cancel As Integer)
|
by: chicago1985 |
last post by:
I have a unique constraint in my Oracle table for 3 fields. If I enter duplicate info on the table using Oracle client I will get an Ora message error ORA-00001 that tells me it is a duplicate entry attempt.
How do I capture that in my PHP page if someone tries to enter duplicate record info?
My PHP Oracle insert statement in the action page:
$s = OCIParse($c, "insert into tableOne values ('$varOne', '$varTwo', '$varThree')");...
|
by: jbrumbau |
last post by:
Hello,
I have been successfully using a database I've created for several months to populate an equipment list for a project we've been working on. However, the form has recently stopped working for some unknown reason. I've been having a problem recently where one table (Project Info) keeps auto-incrementing when I try to create a new record with another table (Equipment Info). Only the Equipment table is supposed to grow. It used to never...
|
by: azura |
last post by:
how i want to check if there is duplicate entry in my database?? i insert new record which is the same record that i had inserted before,it successfull insert into the database..i don't want that.. what i want is the error must appear when i try to save the same previously record.. can you all help me please... newbie in php..
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |