bonanzab Posted March 17, 2006 Share Posted March 17, 2006 Hi Everyone,Let me start by saying that I do not know anything about PHP script. I have this script that I would like to change but I don't have the foggiest idea on how to do it.Presently this script reads from a text file that use this type of “|”separator, now I would like to change this code to read from a Mysql database, plus add other fields that are not currently read. I know that some of you like the challenge and I can tell you that this will be so. Is there anyone that will do this for free? This is part of the script, I can post the rest or email the rest to the person who is willing to help.[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]<?PHPif(isset($_POST['search'])){ $fp = file("reg.txt"); $search = "/".$_POST['search']."/i"; $y = 0; $results[0]=Array(); $results[1]=Array(); $results[2]=Array(); $results[3]=Array(); $results[4]=Array(); for($x=0; $x<count($fp); $x++){ $search_text = ""; if(@$_POST['radiobutton']==5){ $search_text = split("\|",$fp[$x]); $search_text = $search_text[4]; }else if(@$_POST['radiobutton']==4){ $search_text = split("\|",$fp[$x]); $search_text = $search_text[3]; }else if(@$_POST['radiobutton']==3){ $search_text = split("\|",$fp[$x]); $search_text = $search_text[2]; }else if(@$_POST['radiobutton']==2){ $search_text = split("\|",$fp[$x]); $search_text = $search_text[1]; }else{ $search_text = split("\|",$fp[$x]); $search_text = $search_text[0]; } if(preg_match($search,$search_text)){ list($results[0][$y],$results[1][$y],$results[2][$y],$results[3][$y],$results[4][$y])=split("\|",$fp[$x]); $y++; } } [/quote] Quote Link to comment https://forums.phpfreaks.com/topic/5154-text-database-to-mysql/ 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.