karthikeyan_coder Posted November 3, 2006 Share Posted November 3, 2006 Hello, i am using flat file database...the data format isgoogle.com || Googlemsn.com || MSNfile name: data.txti need to delete a row if the id is first column...let us say.. i need to delte the second row.. by clicking some link like.. deletelink.php?url=msn.com$url = $_GET['url'];now i need to delte the row which starts from $url from my text file... how is it possible? any help.. ??? Quote Link to comment Share on other sites More sharing options...
Barand Posted November 3, 2006 Share Posted November 3, 2006 [code]<?php$lines = file ('data.txt');$fp = fopen('data.txt', 'w');foreach ($lines as $line) { list ($url,$desc) = explode ('||', $line); if ($_GET['url']!= trim($url)) fwrite ($fp, $line);}fclose ($fp);?>[/code] Quote Link to comment Share on other sites More sharing options...
karthikeyan_coder Posted November 3, 2006 Author Share Posted November 3, 2006 Great :) Again you proved that you are Great Barry :) it works fine.. :) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.