Jump to content


Photo

Text database to Mysql


  • Please log in to reply
No replies to this topic

#1 bonanzab

bonanzab
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 17 March 2006 - 10:17 AM

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--]<?PHP
if(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]




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users