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
Help With editting and deleting form
Hallo !!
So look at this image :
http://img194.imageshack.us/img194/8272/snapshot5f.pn
If a record matches an existing record do nothing
So I don't know if I should put this here or in mysql, but what my script is for is for people to ad
Registration
ok so i have a site where people can register and login which works now thanks to someone on here th
Creating an invoice
Using fpdf I am trying to create an invoice to send to clients. The products are sold in pricing tie
sql problems
I am having a small problem with my sql statement. it is inserting into 4 of the fields.
fie
Progress bar tracking file downloads
Hey guys, was wondering if there was a way to track how far a file has been downloaded. I know there
couldn't connect to your database
Hello I am new to php mysql
Actually i have read A tutorial on nettuts
"http://net.tu
using a loop help
Hi guys , i need some help. I have this loop :
while ($row = mysql_fetch_assoc($Result)) { ?&
how to get different value in second view of webdynpro?
hello guys,
In ABAP webdynpro I am trying to create one application having two views.
Remove Rows From Database ad
Hi All,
I have this:
Code: [Select]<?php
session_start();
include('../com