Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8589057
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T22:57:13+00:00 2026-06-11T22:57:13+00:00

I have searched and searched for a simple solution and I am afraid there

  • 0

I have searched and searched for a simple solution and I am afraid there may not be a simple one after all of my research…

Here is what I have… All users who are authorizing the twitter app are opting in to being added to a list (the csv file) to be followed by other users. Its a spot for users with the same interest to follow each other.
Here is what I am trying to achieve. I have users authorizing their twitter account which inserts their username into a csv file using php.

Users can only access the page once they have inserted their twitter which I am using oauth to authorize is an actual twitter account.

However, if the user visits the page again, they will be inserted into the csv file again.
I have very simple logic to prevent an insert if they refresh the page and whatnot (when the $username value is blank).

<?php
if ($username == '') //check if $username is blank so empty row isnt inserted
{}
else{
$cvsData = $username."\n";
$fp = fopen("Twitter.csv","a"); // $fp is now the file pointer to file $filename
if($fp){
fwrite($fp,$cvsData); // Write information to the file
fclose($fp); // Close the file
  }
}
?>

There is no header row in the file. It is just a single column of twitter handles.
I know the logic sounds kind of simple:

open csv file
loop through each row searching for value of $username
if $username exists - close file
else append $username
close file

Unfortunately I am learning still and having trouble finding a solution. Perhaps its the loop part that I need help with? Or a starting point. I am not at all looking for the code to make this happen though that would save me time. I’m not afraid to learn it – just having trouble finding the solution on my own. Any help is very much appreciated!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T22:57:15+00:00Added an answer on June 11, 2026 at 10:57 pm

    array_unique — Removes duplicate values from an array

    Put the the values from the csv into an array and run array_unique() on it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

(have searched, but not been able to find a simple solution to this one
In this question I have searched for a simple solution to unblock files. Thanks
I have searched all around to find a solution to my problem, but i
I have searched around the net and the solution must be so simple no
I have searched high and low looking for a simple class or set of
I have searched but can't find why this simple code will fail in Drools
I have searched everywhere but can't find a simple example of paging in MySQL
Preface: I am sure this is incredibly simple, but I have searched this site
I have what I know is a simple question, but after many searches in
I have searched for a general solution to this but only find answers to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.