pnutUUM Posted March 2, 2006 Share Posted March 2, 2006 hello,i just want to know how can i read content from a file to be used as the input to be saved in the database...what i want to do is to read a text file containing student's matric number and their names. the user only have to browse the location of the file to register students. then the matric numbers and names will be added to the database....so,no need to register students one by one...can anybody help me? Quote Link to comment Share on other sites More sharing options...
heckenschutze Posted March 2, 2006 Share Posted March 2, 2006 There are 2 main methods:The C based way (example from php.net):[code]<?php$filename = "/usr/local/something.txt";$handle = fopen($filename, "r");$contents = fread($handle, filesize($filename));fclose($handle);?>[/code]Or the easy, new PHP way:[code]<?php$filename = "/usr/local/something.txt";$contents = file_get_contents($filename);?>[/code]is that what you were after? 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.