PHP Coding
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsPHP RelatedPHP Coding

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
  #1  
Old July 13th, 2002, 06:03 AM
harsha harsha is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: india
Posts: 17 harsha User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via Yahoo to harsha
file handling help

i have stored data in a text file "data.txt" and i want to search a email address
form that file can i do like this

$filename="data.txt";
$fptr=fopen($filename,"r");
$content=fread($fptr,filesize ($filename));
fclose($fptr);
if(strstr($content,$email))
{
echo <<< THIS
<font color="red" size="+2" face="verdana">
You have already signed the guestbook
</font>
THIS;

will this work or there is any thing to be added or deleted

Reply With Quote
  #2  
Old July 13th, 2002, 06:12 AM
D1NGO D1NGO is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Perth, Australia
Posts: 221 D1NGO User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 3
RE: file handling help

well i dont really know much about text files, but i'm thinkin it would be easier to use a database if you can get your hands on one.

Once again, not knowing much about text files, but from the looks of it, that doesnt even search the text file for an email address, it just opens it and reads the contents, theres no comparisons like i think you would need to do.

Reply With Quote
  #3  
Old July 13th, 2002, 07:55 AM
notepad notepad is offline
Codewalkers Loyal (3000 - 3499 posts)
 
Join Date: Apr 2007
Location: Central, IL USA
Posts: 3,214 notepad User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via AIM to notepad
RE: file handling help



i'm not sure whether what you're trying will work or not harsha. interesting approach either way, i might take the following route
php Code:
Original - php Code
  1.  
  2. <?php
  3.  
  4. $cheese = file("data.txt");
  5. if(array_search($email, $cheese) != FALSE)
  6. {
  7.     echo "you've got e-mail";
  8. }
  9.  
  10. ?>

Note: Prior to PHP 4.2.0, array_search() returns NULL on failure instead of FALSE.

Reply With Quote
  #4  
Old July 13th, 2002, 08:11 AM
harsha harsha is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: india
Posts: 17 harsha User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via Yahoo to harsha
RE: file handling help

mr D1NGO

i know that it is easier to code using database but it is life if every thing goes smoothly what is the use there should be some difficulties like here using text files then only we get experience in coding
hope you understood

Reply With Quote
  #5  
Old July 13th, 2002, 08:26 AM
D1NGO D1NGO is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Perth, Australia
Posts: 221 D1NGO User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 3
RE: file handling help

yes that is true harsha, although, when trying to solve a problem, finding a solution is not good enough, its all about finding the best solution.

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP RelatedPHP Coding > file handling help


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump




 Free IT White Papers!
 
Create the Optimal Architecture for your Critical Applications
Warburton's the largest independently owned bakery in the UK faced a number of difficult challenges in providing the most robust yet efficient IT infrastructure for their organization's success. IBM's services combined with their xSeries servers created the perfect platform for their SAP environment with sufficient flexibility, and did so in very time effective fashion.

Request Your Free Technology Downloads!
 
Five Best Practices for Deploying a Successful Service-Oriented Architecture
This white paper describes the benefits you can expect with SOA, and how IBM can help take your business there.

Request Your Free Technology Downloads!
 
Gartner Magic Quadrant for Application Delivery Controllers
Gartner summarizes its view on Application Delivery Controllers, evaluates strengths and weaknesses of solutions, and provides Magic Quadrant reporting for a quick comparison across all vendors. Learn from Gartner how you can benefit from an all-in-one device like Citrix NetScaler that delivers the highest levels of availability, performance and security.

Request Your Free Technology Downloads!
 
Knowledge is Power
What you don't know can hurt you, and is likely costing you money and increasing your security risks during an era of scarce resources. This white paper proposes six key strategies that enterprise security managers can use to improve their network defense posture.

Request Your Free Technology Downloads!
 
Rationalizing the Multi-Tool Environment
The rationalized multi-tool approach is flexible, scalable and cost effective. It provides the necessary input to the IT service management business processes. It preserves prior investments in monitoring tools, empowers technologists to select the best tools with which to do their jobs, and enhances effective response to incidents.

Request Your Free Technology Downloads!
 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 




© 2003-2010 by Developer Shed. All rights reserved. DS Cluster 12 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek