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.. ??? Link to comment https://forums.phpfreaks.com/topic/26083-any-one-can-help-if-you-know-files-in-php-but-i-dont-know-solved/ 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] Link to comment https://forums.phpfreaks.com/topic/26083-any-one-can-help-if-you-know-files-in-php-but-i-dont-know-solved/#findComment-119274 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.. :) Link to comment https://forums.phpfreaks.com/topic/26083-any-one-can-help-if-you-know-files-in-php-but-i-dont-know-solved/#findComment-119283 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.