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
How to change Time Zone
HI
I want to change the time zone of the server to another country.How can do that?
Thanks
Multi Dimensional Array Append
Hi Guys
I have a function that returns a multidimentional array eg
$result = functio
Creation of Raw Exposure manually
SAP Gurus
I am creating Raw Exposure ( Hedge management ) thru T Code TEM10 with followin
user data not transferring to new page
I'm a PHP learner. After an index.php page, the user goes to a login.php page. Both pages seem to
Hardcopy printing is to wide
I want to make a hardcopy at runtime of my active form like this
PHP submit form script causing blank page
Im trying to submit a form using this script, however nothing shows up on the page, does anyone know
single values into sql field
i have a form which i want the user to able to select multiple answers. But i want the answers to be
Multiple while loops
I have several DB queries that I know should be returning results and aren't. I have a feeling it ha
array_combine() error
getting an "Warning: array_combine() [function.array-combine]: Both parameters should have an e
Question about the upload of large files
Hi there,
I have a question about the upload of large files, like videos (files generally abo