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
MySQL Does not UPDATE- SQLString Problem
vb Syntax (Toggle Plain Text)
1.
SQL = "UPDATE sampletable SET column1 = 'C1sample1'"
Image upload - determine folder
I have an upload script that may be accessed from different directories. Problem is, the script is m
Linux socket programming
Where can I find a good introduction to socket programming?
in php, link returns to the line
When I add a link in a php page, the link word returns to the line (as a
would do)
Examp
listing help
Hi,
at first, great new design!!! I like it,
i got a problem,
I want to list so
Can I use a loop
Hi buddies!
Once again with my doubts here.
Right now I am using this sql stat
pull content
I have an existing page, domain/adverts.php which has a good PR. I've just rebuilt my site and the n
Help please - 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
Converting numbers to months
The porgram works -just need the last function(month_convert_ to convert numbers to months -thanks.
CURL XML Request [From C to PHP]
Hi,
I need some help converting this into something that will work with PHP.
Code: #