Prevent Adding Duplicate Records
theres a XML file located on the internet. every week or so. this xml file gets updated with one or two new entry's.
i have a php script which can read all the entrys i want from this xml file. and then put it into a database.
the problem is say i run the php script again to update the database and add the new entry's that the xml file has. every thing gets added again. each time the script is run. the enter xml file entry's are added again.
so the database get full with duplicates triplcate records ect ect.
how would i go about preventing the same record being added over and over.
View Complete Forum Thread with Replies
Related Forum Messages:
Prevent Duplicate
I have this code that inserts the email address into a database but I want to check the database to see if that email address already exists and if so tell the user. I've looked all over to find out how to do this. PHP Code:
View Replies !
Prevent Duplicate Record Entry Oracle 9i
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...
View Replies !
DELETE RECORDS - Database Adding New Records
iv got the database adding new records, and now I want it to display all of the records that are there buy name and id number, then i want u to be able to type in the id number of the customer u wish to delete and it shoudl delete it, sounds good buts its not actually deleting the record. it says it does, but its not doing it. Code:
View Replies !
Duplicate Records
I have an address field in my DB and I would like to pull up all the addresses that have multiple entries along with all the corresponding entries. I have tried the suggestions suppplied here http://ight=duplicate but to no avail either;
View Replies !
Print Non Duplicate Records
I want to search a table and display the records which are not duplicated in a different field of the same table. For instance I can print the duplicate records with this piece of code:
View Replies !
Count Duplicate Records
I have a script that adds a record each time a photo is viewed, as well as the time it was viewed. I am doing it that way as I want to be able to delete any records over 1 week old. What I would like to get out is the highest views. Basically it would look at all the records and tell me which photo has the most views. Is there a way to count duplicate records and sort descending?
View Replies !
Duplicate Records Problem
I am using the following code to insert records into a temporary table then to check for duplicate records in my temporary table and then inserting into my duplicate table. Code:
View Replies !
How Do I Prevent Mysql From Printing Redundant Records?
I have a very urgent question. I am using php and mysql. Say I have a database full of names and email addresses. I want to do a query that when you type in the name or partial name, mysql will only show a name once, even if it is in the database 200 times. Then I want to click on that name and have mysql show the 200 email addresses associated with that name (which I know how to do). See below:
View Replies !
Duplicate Records In DB When Importing From CSV File
The code below is used to grab each row from a CSV file (except the first row) and insert it into a database, as long as it's not already in the DB. If I echo each row's data, it appears only once on the page. But, for some reason it inserts each row into the database 3 times. The code that echos the data, and the DB insertion code all appear within the same for loop. The database insertion code (below) works perfectly in another script. It's just copied/pasted into the for loop. $row = 0; $handle = fopen ("some-file.csv","r"); while ($data = fgetcsv ($handle, 1000, ",")) { if($row == 0){ // set the varible array $num = count ($data); $csvNames = array(); for ($c=0; $c < $num; $c++) { $csvNames[$c] = $data[$c]; eval("$" . $data[$c] . " = array();"); } $row = 1; }else{ $num = count ($data); $row++; for ($c=0; $c < $num; $c++) { $buildEval = "$" . $csvNames[$c] . " = "" . $data[$c] . "";"; eval($buildEval); echo $buildEval . "<br>"; // this properly displays only one row's data from the CSV file, then displays the next row in the CSV file when it loops again. // BUT FOR SOME REASON, THE DB CODE BELOW INSERTS EACH ROW FROM THE CSV FILE 3 TIMES. // Set variables with current date and time to be inserted into DB later $appDate = date('Y-m-d'); $appTime = date('H:i:s'); // Prepare the phone numbers for easy input into the database further down this page. $fHomePhoneCombined = $fHomePhone1 . "-" . $fHomePhone2 . "-" . $fHomePhone3; $fBusinessPhoneCombined = $fBusinessPhone1 . "-" . $fBusinessPhone2 . "-" . $fBusinessPhone3; // Connect to the database $db = mysql_connect ("localhost", "username", "password"); mysql_select_db ("mydatabase"); // Check to see if the record is new, $newRecord = 1; $queryNewRecord = mysql_query("SELECT * FROM cust_test WHERE first_name = '$fFirstName' AND last_name = '$fLastName' AND email = '$fEmail'"); if (mysql_num_rows($queryNewRecord) > 0){ $newRecord = 0; } // If it's NOT a new record, insert the contents into cust_test_bad DB // I'll insert this code later. It's not important for this test. // Write the information to the customers table, if it's a new record. if ($newRecord == 1){ $query = "INSERT INTO cust_test SET application_date = '$appDate', application_time = '$appTime', first_name = '$fFirstName', last_name = '$fLastName', email = '$fEmail', address = '$fAddress', state = '$fState', zip = '$fZip', home_phone = '$fHomePhoneCombined', best_time_to_call = '$fBestTime', lead_buyer = '$lbuy'"; $result = mysql_query($query) or die('Failed because: '.mysql_error()); } } // end of for ($c=0; $c < $num; $c++) } } fclose ($handle);
View Replies !
Checking For Duplicate Records In Database
i got a form <form method="post" action="haha.php"> username<input type="text" name="username"> <br> email<input type="text" name="username"> <br> <input type="submit" value="submit"> </form> now i want to add a button beside the username field to check whether the user name is duplicated in database.
View Replies !
Suffix A Number To Duplicate Records
When querying the DB for records, many of the records have the same name. These names are not really duplicates because they are unique. For the records returned that have the same name, I would like to suffix a number at the end. For example: john01 john02 chris01 chris02 chris03 tom jack Btw, I do not want to add the incremented ID, because there are many records, 100,000+ and above. The ID would be too big of a number to add as a suffix. I need to add the suffix number to the duplicate names and not to the names that do not repeat.
View Replies !
How Prevent IE From Adding [1] To Name Of A File Passed By Readfile()?
I'm using the following code example from php.net to pass a binary file via a php script: header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: private",false); header("Content-Type: application/octet-stream"); header("Content-Disposition: attachment; filename="".basename($filename)."";"); header("Content-Transfer-Encoding: binary"); header("Content-Length: ".@filesize($filename)); set_time_limit(0); @readfile("$filename") or die("File not found."); $filename is set for example to /name-2.0.cgm In Firefox the "Save As" dialog correctly suggests this name. But IE6 suggests the following name: name-2[1].0.cgm Anyone knows how I can prevent IE from adding the [1]?
View Replies !
Joining Tables Generates Duplicate Records/Pairs
I am facing an unique issue when joining tables. Basically, I need to display the records containing the number �' FROM the two Tables, Table1 and Table2. What's happening is, the queries returned are returned in pairs. Example: If �' exists once in Table 1, and twice in Table 2, then instead of 3 records, 4 records are being displayed. The same record �' is being displayed twice from table 1 along with the other two records from Table 2. The correct number of displayed records should be 3. (1 record from Table1 and 2 records from Table2) Code:
View Replies !
Adding Multiple Records
i have mysql database table named 'table' it has fields : id (auto increment) , name , message , category , views currently i have php script that only adds one record at a time.now i want to add 10 records at a time.
View Replies !
Adding A Number To All Records
is there a query structure that will enable me to add, say, 10 to all records in a certain column without doing 2 queries for each record (one to get the current value and one to update it with the new value.
View Replies !
Eliminating Spammers From Adding Records?
I have a website that allows users to add records for their events. Recently I've had a bunch of spammers coming in. Do you have any tips on how to keep them from entering bogus information. I have started checking for any "http" in some of the fields but I want to make it even harder for them. Is there a way to check what the referring page is and if it is not the right one to produce an error?
View Replies !
Adding Multiple Records To A Table In One Form.
I have one form in a php page. In that form there are several rows, each with several input boxes. These rows represent individual products and their price. You may add as many products as you want by clicking a add product button and it will add another row using javascript. When you are finished adding your products you then click submit. For each product I would like it to insert an individual record in the products table. For example if you add 10 products, when you click submit it will add 10 records in the product table.
View Replies !
How To Prevent PHP From Adding "" To Quotations
I have a form, and when I enter something with quotations, like: I am a php "newbie" Somehow when I extract that content using PHP, the end result is always: I am a php "newbie" How can I stop it from adding the backslash to the content? I tried a regular expression like: $stuff=ereg_replace("","",$stuff); to search and replace "", but it gave me an error.
View Replies !
Displaying Priorty Records And Normal Records In The One Dataset.
I have a page which displays the records from the database and uses paging to display the records in groupes of 10 per page. I now want to be able to show results depending on the database field (display) in the database (can be set to either "full" or "limited"). If the record and the field display is equal to "full" i want to then display this record at the top of the record set and display all the fields. If the record is equal to "limited" i want to display different results and they must show after all the records which are equal to "full". I can't output two different recordsets as i use paging and only want to show 10 records per page. Code:
View Replies !
Problems With The Listing Of Records, Editing Of Records
I'm having problems with the listing of records, editing of records, and deleting of records. I'm not sure what I'm doing wrong. The listing script is calling the add entry script. So I add the record, the database is updated, and nothing else happens. I don't get a list of records from that table. When I did SQL programming off the mainframe, you did a simple select statement. I'm not sure why the PHP list script is calling the add entry script. Code:
View Replies !
How To Prevent Tag-execution
perhaps this question is too easy, so i cant find an answer, or i'm too stupid. However, i'm writing a guestbook, and i don't want the tags user could write to be executed. This must have an easy solution, cause its used in evry forum or guestbook, isn't it? Can the tags be escaped? but do i have to replace every single existing tag, or is there a specific function?
View Replies !
What Would Prevent HTTP_REFERER?
I have a script which uses a HTTP_REFERER check to block unauthorized access to that script. Works fine, has been working for a few months now. However, I recently had a friend tell me that he was accessing the script in the proper manner, only to be told by the script that he was unauthorized. I rewrote the error message to display the HTTP_REFERER, and it was blank. Apparently, when he clicks his way to the script, that variable is not passed on. So, I'm looking for everyone's ideas on what might cause this, and what has been known to cause this. Remember, this is a case of the script not working on a single computer (a PC, that's all I know). There have been other short threads here and there about this, but perhaps this could become the definitive one.
View Replies !
Prevent Downloading
I recognized today that if I have an echo statement on an else at the end of my script the only thing which was downloaded by wget was this string. Is this a common way to prevent uncontrolled downoading of php scripts? The software I wrote is GPL licensed so I would share it as package not as partial files.
View Replies !
How Would I Prevent PHP GD Cache?
How can I prevent my PHP GD code below from caching in browser? I guess that I would use a header; but I am not sure where to put it; it tried to put it before "imagejpeg($image)", but that did not help. The problem is that when I use a pop-up the image will display from cache and then be displayed again from PHP GD script. Code:
View Replies !
Prevent Going To Next Record In The URL
I am wondering about the best way to prevent users from going to the next record in a database by using the URL bar. So if I have this in the URL: www.site/items.php?itemno=2 I want to prevent them from going to the url and typing in 3 etc.
View Replies !
Prevent Duplicates
I have a simple db with three columns,id name and details. There are two forms for adding and editing details, to be sure that the add details form does not create duplicates i need to: check that a name does not already exist before the new data is inserted, if the name already exists then i want to simply update the details.
View Replies !
Prevent Certain Strings
how could i prevent certain strings being posted on a shoutbox? e.g. if the message contained *www.* in any part of the post, im pretty sure this involves using eregi, but i am not sure how to do this. else if (ereg('------', $message)) { Â Â die ("No spam please");
View Replies !
Prevent ' Being Replaced With
When I am echoing a row from a database, if the string contains "'", it will be displayed as "?" How do I prevent this? I've tried urldecode, etc. but can't find a solution.
View Replies !
Spam Prevent
i have a script on my site that will let people email other members is there anyway i can have a timer on it so after some one sends a message they will have to wait 1 minute to send another message?i don't have a clue on how to do this but need to get it done i keep banning the spammers but they send alot of messages before i ban them.
View Replies !
Prevent Headers
I need to start/close the current session ($_SESSION) because of the lock session set on the session file, which i need to be unlocked. Anyway, currently when i use a function that looks something like this. function setSessionVar($varname, $value) { session_start(); $_SESSION[$varname] = $value; session_write_close(); } It adds a session cookie everytime the session_start() gets called. This adds multiple cookies with the same session name, value, expire date etc. Is there a way to prevent the cookie/header to be set or something?
View Replies !
Prevent Copies
my website written in PHP is finished. It's a niche website with an admin section and it's very easy to use for building your own niche website. My intention was to sell the script and hey, I already sold one copy but what do I see. this ass.ipe is selling my script. How can I prevent my script from being copied? I can think of some ways to make it more difficult to prevent illegal copies but how do I prevent an illegal installation from my script?
View Replies !
Prevent Spammers
I'm writing small script for sending mail from my web pages. I have heard about security hole in FormMail.pl script which can be used by spammers. I would like to prevent that in my script.
View Replies !
Prevent Opens Php
Hello world i have a site where i want to show hotel information in the form. Php constructs content. I call a form in the client side where i place with <iframe> link to that php.
View Replies !
Prevent Blank Data
How do I prevent blank data from being entered into a table? For instance, the user fills out a form, but if a field is left blank, then the entire entry won't be filled in. This isn't necessarily a form validation thing, just that if all the fields are filled, then proceed to enter data, if not then don't.
View Replies !
Prevent Two User Login ?
I written a php application which is is password protected application. I want to prevent both users using the same user id and password login at the same. While both of them login at the same time, one of them must b kick out from the application.
View Replies !
Prevent Loading Of Php Pages
I have a website consisting of php segments. Example page1.html calls in code from seg1.php and seg2.php If the user goes directly to www.mydomain.com/seg1.php they see everything visible to a browser on that page. Can I prevent users from loading individual php segments. The only time that seg1.php should be visible is in its original context on page1.html
View Replies !
Please Help: Prevent Multiple Instances
How can I prevent a script from running when a previous instance of the script had already been triggered and the script is running in the background already? So, even when a script is startet several times (eg. by several website visitors) I want only one script-instance running on the server. Subsequent instances should be exited (or prevented) right away to keep the server load as low as possible. However, when no instance of the script is currently running (eg. after a server shut-down), triggering the script should make it run - but again: only one instance should be running at all times. Further script calls, as said above, should then not be allowed.
View Replies !
Re Prevent Loading Of Php Pages
a while back, on website a security issue that comes up often. Gary Jones was asking how to keep users from directly accessing php pages, out of sequence. Jerry posed a directory management solution. No one seems to have mentioned an alternative. Maybe there is a reason? We took a different approach, noting that the only way we wanted a user to enter some phps would be through a predefined series of steps like that posed by Gary Jones. Header information (http_referer, or maybe another) is a path check. If a client request hits, say, step_4-something.php without going through steps 1, 2, & 3, the php takes suitable action, maybe posting an error message.
View Replies !
Prevent Re-posting Of Data
how can I prevent the re-posting of data on an auth login form. Right now the auth form works fine, but when a user logs out and then click the back buttom of the browser, the browser pop a windows asking for reposting the data, if the users clicks Ok. the username/password are submitted and he is logged in back again.
View Replies !
|