TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   General (http://www.talkphp.com/general/)
-   -   Only add if not found... (http://www.talkphp.com/general/4660-only-add-if-not-found.html)

Peuplarchie 07-01-2009 09:21 PM

Only add if not found...
 
Good day to you all,
My code is looking for user name in a file, if match found, do nothing, if no match found, add to list.

Right now, it add anyway !

PHP Code:



$activeadmlist 
"user_list.txt";
$pos strpos($activeadmlist$_SESSION['username']);

if (
$pos === false) {

$output$_SESSION['username']."\n";
$newfile="user_list.txt";
$file fopen ($newfile"a");
fwrite($file$output);
fclose ($file); 


} else {
    



Thanks!

Enfernikus 07-01-2009 09:28 PM

Did not Salathe give you a solution of sorts for the sort of things which is causing your issue right now? By the way. Use a database.

Peuplarchie 07-01-2009 09:31 PM

I can't for this...

Salathe 07-01-2009 10:34 PM

Can't or won't? Either way, many helpful posts have been written just today in direct reply to your question. *!*


All times are GMT. The time now is 09:43 AM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0