Jump to content

Text database to Mysql


bonanzab

Recommended Posts

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]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.