Preventing blank or already entered values
Posted on
16th Feb 2014 07:03 pm by
admin
Im trying to learn how to place a read file line by line and prevent duplicate entries and also BLANK entries, into my process php script,
using feof, I have failed many times and get so many errors such as syntax expecting . or , and so forth
this is my process.php
Did you know?Explore Trending and Topic pages for more stories like this.
<?php
$File = "links.txt";
$Handle = fopen($File, 'a');
$Data = "".$_POST['ID'];
fwrite($Handle, $Data."n");
print "Data Addedn";
fclose($Handle);
?>
<?php
countLines("links.txt");
function countLines($filepath)
{
$handle = fopen( $filepath, "r" );
$count = 0;
while( fgets($handle) )
{
$count++;
}
fclose($handle);
return $count;
}
?>
<head>
<meta http-equiv="REFRESH" content="5;test1.php"></HEAD>
please wait... navigating back!
I got fed up and deleted all my work, to start from scratch,
if feof($_POST['ID'])
{
alert 'Already entered';
return;
}
that was just one of my attempts
also im unsure if putting in /n would make it look for /n or new line, if it looks for new line and every file has the new line marker would it always return as the data was already entered?
Thanks in advance for assistance/teaching
No comments posted yet
Your Answer:
Login to answer
241
9
Other forums
ereg_replace()
Basically what i need to do is
$title = "This Suck's"
$striped = ereg_repl
if php cookie set, show code...
Hi all.. I need to figure out this little snippet right quick.. seems like it should be easy enough
Word filter problem
Hello,
im trying to make a filter for words inputted in to my website but i want to store the
Comparing Values
Hi
I'm reading data from a database and this seems to work OK.
Each system has an associat
Downloading file (Headers)
I'm trying to make users download a file, but they must wait 60 seconds before it begins.
But
How to validate from 2 possible answers
Hi
I hope somebody can help me with what will probably be really simple, I'm pulling my hair
How would I do "Users not logged in since *** delete them"
I know how I would set this up, and delete the user roughly.
I'll create a table called "Use
Image loading
Hi Developers,
I'm trying to display an image from images/image.gif getting the url from mysq
Creating XML with php
I need to creat an XML with php and have successfully produced a valid output.
The problem I hav
Ajax not working on IE 6 for Windows CE
I've created a webpage which uses the classis Ajax in following format:view plaincopy to clipboardpr