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 SOAP Issue Hi, I am facing some understanding problem with SOAP basic.kindly recommend some SOAP expert.
media recovery Hi, i startup the database i got the error SQL> startup ORACLE instance started.
PHP hyperlinks generator - HELP plz Hi I need some help to get this done using php: 1 - I have few hyperlinks say 500
Can we convert non uni code system into unicode Hi All,
Presently i am using non-unicode system and the sap version is 4.7.
Can i c
form problem below in the form action, i've put "test.php?w=$sw&h=$sh" but when i input the for
Onclick problem in Firefox Hi, I am using a . It doesn't seem to
Displaying Site Logo/Icon on a Title tag really need some help out here. I want to insert a Logo/Icon just like the one close to the "PH
I apologise! It's a newbie to PHP feedback form problem! Hi, I am a total newbie to PHP. I am also a unemployed and need to get a job. So after 100% r
Populate drop down list from table?? Lets say for arguments sake that i have a table which contains the numbers 1 to 10. How can i get
Hotlinking Picasa as the image folder of a website Hi there PHP freaks, I would like to create a private album in Picasa to use it as the image folder