addyp Posted September 24, 2010 Share Posted September 24, 2010 Hey guys, im new hear so im not shore how things work. Iv got a project where we are ment to alow users to record a bug fault in a computer, currently i have a page that looks like ths: <?php if (empty($_POST['bug_ID'])) echo "<p>You must enter a BUG ID number</p>"; else { $bugID = addslashes($_POST['bug_ID']); $name = addslashes($_POST['bug_name']); umask(0007); if (!file_exists("../../data/lab05")) mkdir("../../data/lab05", 02777); $lab05 = fopen("../../data/lab05/". "$bugID.txt", "a"); if (is_writable("../../data/lab05/NewBug.txt")) { if (fwrite($lab05, $bugID . ", " . $name . "\n")) echo "<p>Thank you entering a new bug</p>"; else echo "<p>Cannot add bug</p>"; } else echo "<p>Cannot write to the file.</p>"; fclose($lab05); } ?> this code runs fine however I also need to write a sperate page that allows for users to search and up date bugs recorded, I want them to search using the bug_ID field and we are ment to use the fgets method but am unshore, anyhelp would be much apricated. thank you Quote Link to comment Share on other sites More sharing options...
milesap Posted September 24, 2010 Share Posted September 24, 2010 I would ask a specific question after you've done some research yourself if your having trouble putting it all together rather than posting code and asking someone to write the script for you. Quote Link to comment Share on other sites More sharing options...
addyp Posted September 24, 2010 Author Share Posted September 24, 2010 Im not looking for an easy out, just someplace to start, currently this is what i have <?php $Search = addslashes($_POST['bug_ID']); $handle = fopen ("/tmp/$Search.txt", "r"); while (!feof($handle)) { $buffer = fgets($handle, 4096); if (file_exists(rtrim($Search,"\n"))) { echo $buffer; } else { echo $buffer." has been removed."; } } fclose ($handle); ?> however it is resulting in an infantent loop. i am just unsure how to use these methods 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.