enid1horse Posted March 5, 2008 Share Posted March 5, 2008 I have a form that passes info to db, then to another form with a drop down menu, when I try to print out a single record I get all records instead of the selected one. Code is: $fileName="assess1.file"; $fh= fopen( $fileName, 'r'); while ( ! feof($fh)) { $line = fgets( $fh, 2048 ); $line = trim ( $line ); $dataArray = explode("~",$line); if ( $line == $_POST['name'] ) { print $dataArray[0]." ".$dataArray[1]."<br />"; print $dataArray[2]." ".$dataArray[3]."<br />"; print $dataArray[4]." ".$dataArray[5]." ".$dataArray[6]."<br />"; print $dataArray[7]; } else { print $line."<br /><br />"; } } fclose( $fh); This has me and others going crazy. Any help would be greatly appriciated. ??? Link to comment https://forums.phpfreaks.com/topic/94589-printing-selected-record-from-database/ Share on other sites More sharing options...
uniflare Posted March 5, 2008 Share Posted March 5, 2008 debug ur vars, try: echo($line." - ".$_POST['name']."<br />\n"); if ( $line == $_POST['name'] ) { print $dataArray[0]." ".$dataArray[1]." "; hope this helps, Link to comment https://forums.phpfreaks.com/topic/94589-printing-selected-record-from-database/#findComment-484384 Share on other sites More sharing options...
enid1horse Posted March 7, 2008 Author Share Posted March 7, 2008 I've solved the problem, Thanks for the help. Now I can get into my finals project, maybe graduate some day. Link to comment https://forums.phpfreaks.com/topic/94589-printing-selected-record-from-database/#findComment-486507 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.