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("scott", "tiger", "orcl");
if ( ! $c ) {
echo "Unable to connect: " . var_dump( OCIError() );
die();
}
$s = OCIParse($c, "INSERT INTO personTable
(firstname,lastname,emailaddress) 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 4442
<te****@hotmail.comwrote in message
news:37**********************************@i3g2000h sf.googlegroups.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("scott", "tiger", "orcl");
if ( ! $c ) {
echo "Unable to connect: " . var_dump( OCIError() );
die();
}
$s = OCIParse($c, "INSERT INTO personTable
(firstname,lastname,emailaddress) 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**********************************@i3g2000h sf.googlegroups.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("scott", "tiger", "orcl");
if ( ! $c ) {
echo "Unable to connect: " . var_dump( OCIError() );
die();
}
$s = OCIParse($c, "INSERT INTO personTable
(firstname,lastname,emailaddress) 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("scott", "tiger", "orcl");
* if ( ! $c ) {
* * echo "Unable to connect: " . var_dump( OCIError() );
* * die();
* }
$s = OCIParse($c, "INSERT INTO personTable
(firstname,lastname,emailaddress) 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**********************************@1g2000hs l.googlegroups.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("scott", "tiger", "orcl");
if ( ! $c ) {
echo "Unable to connect: " . var_dump( OCIError() );
die();
}
$s = OCIParse($c, "INSERT INTO personTable
(firstname,lastname,emailaddress) 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**********************************@1g2000hs l.googlegroups.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("scott", "tiger", "orcl"); if ( ! $c ) { echo "Unable to connect: " . var_dump( OCIError() ); die(); }
$s = OCIParse($c, "INSERT INTO personTable (firstname,lastname,emailaddress) 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#1975
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("scott", "tiger", "orcl");
if ( ! $c ) {
echo "Unable to connect: " . var_dump( OCIError() );
die();
}
$s = OCIParse($c, "INSERT INTO personTable
(firstname,lastname,emailaddress) 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...
|
by: Manish |
last post by:
The topic is related to MySQL database.
Suppose a table "address" contains the following records
-------------------------------------------------------
| name | address | phone |...
|
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...
|
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...
|
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)...
|
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...
|
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...
|
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...
|
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.....
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM)
The start time is equivalent to 19:00 (7PM) in Central...
|
by: erikbower65 |
last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps:
1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal.
2. Connect to...
|
by: linyimin |
last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
|
by: kcodez |
last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
|
by: Taofi |
last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same
This are my field names
ID, Budgeted, Actual, Status and Differences
...
|
by: DJRhino1175 |
last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this -
If...
|
by: DJRhino |
last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer)
If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _
310030356 Or 310030359 Or 310030362 Or...
|
by: lllomh |
last post by:
Define the method first
this.state = {
buttonBackgroundColor: 'green',
isBlinking: false, // A new status is added to identify whether the button is blinking or not
}
autoStart=()=>{
|
by: Mushico |
last post by:
How to calculate date of retirement from date of birth
| |