Jump to content

dopey

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

dopey's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. i would search by id but this would be a person searching for info just like on google or soemthing they wont know the id number
  2. does anyone have a code todo this? a snippet or soemthing ive tried a few diffrent ones ive seen but nothing that works.. it takes whats submited in search, then takes the words, breaks them up and creates a query string with all the diffrent feilds... here is what phpadmin produces when i search SELECT * FROM `breedclads`.`activeamahorse` WHERE (`id_entered` LIKE '%green%' OR `uuid` LIKE '%green%' OR `ama_hr_coat` LIKE '%green%' OR `breedable` LIKE '%green%' OR `ama_hr_sex` LIKE '%green%' OR `ama_hr_age` LIKE '%green%' OR `date_entered` LIKE '%green%' OR `ama_hr_eyes` LIKE '%green%' OR `ama_hr_eyes_type` LIKE '%green%' OR `ama_hr_mane` LIKE '%green%' OR `ama_hr_tail` LIKE '%green%' OR `ama_hr_luster_coat` LIKE '%green%' OR `ama_hr_luster_hair` LIKE '%green%' OR `ama_hr_gleam_coat` LIKE '%green%' OR `ama_hr_gleam_hair` LIKE '%green%' OR `ama_hr_parents` LIKE '%green%' OR `ama_hr_sale_type` LIKE '%green%' OR `ama_hr_sale_price` LIKE '%green%' OR `ama_hr_location` LIKE '%green%' OR `auction_date` LIKE '%green%' OR `picture_type` LIKE '%green%' OR `picture_name` LIKE '%green%' OR `picture_size` LIKE '%green%' OR `picture_content` LIKE '%green%' OR `ama_hr_coat_type` LIKE '%green%' OR `ama_hr_coat_gloom` LIKE '%green%' OR `ama_hr_hair_gloom` LIKE '%green%' OR `ama_hr_slurl` LIKE '%green%' OR `class_link_key` LIKE '%green%') AND (`id_entered` LIKE '%albino%' OR `uuid` LIKE '%albino%' OR `ama_hr_coat` LIKE '%albino%' OR `breedable` LIKE '%albino%' OR `ama_hr_sex` LIKE '%albino%' OR `ama_hr_age` LIKE '%albino%' OR `date_entered` LIKE '%albino%' OR `ama_hr_eyes` LIKE '%albino%' OR `ama_hr_eyes_type` LIKE '%albino%' OR `ama_hr_mane` LIKE '%albino%' OR `ama_hr_tail` LIKE '%albino%' OR `ama_hr_luster_coat` LIKE '%albino%' OR `ama_hr_luster_hair` LIKE '%albino%' OR `ama_hr_gleam_coat` LIKE '%albino%' OR `ama_hr_gleam_hair` LIKE '%albino%' OR `ama_hr_parents` LIKE '%albino%' OR `ama_hr_sale_type` LIKE '%albino%' OR `ama_hr_sale_price` LIKE '%albino%' OR `ama_hr_location` LIKE '%albino%' OR `auction_date` LIKE '%albino%' OR `picture_type` LIKE '%albino%' OR `picture_name` LIKE '%albino%' OR `picture_size` LIKE '%albino%' OR `picture_content` LIKE '%albino%' OR `ama_hr_coat_type` LIKE '%albino%' OR `ama_hr_coat_gloom` LIKE '%albino%' OR `ama_hr_hair_gloom` LIKE '%albino%' OR `ama_hr_slurl` LIKE '%albino%' OR `class_link_key` LIKE '%albino%') AND (`id_entered` LIKE '%69%' OR `uuid` LIKE '%69%' OR `ama_hr_coat` LIKE '%69%' OR `breedable` LIKE '%69%' OR `ama_hr_sex` LIKE '%69%' OR `ama_hr_age` LIKE '%69%' OR `date_entered` LIKE '%69%' OR `ama_hr_eyes` LIKE '%69%' OR `ama_hr_eyes_type` LIKE '%69%' OR `ama_hr_mane` LIKE '%69%' OR `ama_hr_tail` LIKE '%69%' OR `ama_hr_luster_coat` LIKE '%69%' OR `ama_hr_luster_hair` LIKE '%69%' OR `ama_hr_gleam_coat` LIKE '%69%' OR `ama_hr_gleam_hair` LIKE '%69%' OR `ama_hr_parents` LIKE '%69%' OR `ama_hr_sale_type` LIKE '%69%' OR `ama_hr_sale_price` LIKE '%69%' OR `ama_hr_location` LIKE '%69%' OR `auction_date` LIKE '%69%' OR `picture_type` LIKE '%69%' OR `picture_name` LIKE '%69%' OR `picture_size` LIKE '%69%' OR `picture_content` LIKE '%69%' OR `ama_hr_coat_type` LIKE '%69%' OR `ama_hr_coat_gloom` LIKE '%69%' OR `ama_hr_hair_gloom` LIKE '%69%' OR `ama_hr_slurl` LIKE '%69%' OR `class_link_key` LIKE '%69%') i need this to be made when people search with mutliple words as you can see it searchs each feilds for the green then each feild for albino, so on.. but i wont ever know what there searching for Please help me, thanks
  3. Helloo everyone can someone help me i thought i had this working but i guess not when it displays it wont display any off the results that are in the file that have a ' or , or " it returns all the results for any data in the file that doesnt contian one of these can someone plese help me i have a function but it seems to not be workign witht he file() here this code i have tried mysqli_real_escape, i cant get it to work it gives me a error saying its misisng info this is how i had that in there $data = file('/var/www/htdocs/mp32/playlist.lst', FILE_IGNORE_NEW_LINES); $linesgood = mysqli_real_escape_string($conn1, $data); but no luck $ip=$_SERVER['REMOTE_ADDR']; $date = date(DATE_RFC822); print "<p><center>Loged in as $ip The Date is $date</center></p>"; $data = file('/var/www/htdocs/mp32/playlist.lst', FILE_IGNORE_NEW_LINES); $bad_symbols = array("'",",");// remove these bad symbols $linesgood = str_replace($bad_symbols,"",$data); //this is wher eit removes them or is suppose to but i guess its not becuase the results from mysql dont show back. print "<center><table border=1 frame=void cellpadding=1 cellspacing=0 align=center rules=all><tr><th>Song Position</th><th>Artist</th><th>Title</th><th>Genre</th><th>Action</th></tr>"; require('dbconfig1.php'); while($n < count($linesgood)) { $query = mysqli_query($conn1, "SELECT * FROM mp_id3_tags WHERE filename LIKE '$linesgood[$n]'"); //query database for each one while($row = mysqli_fetch_array($query)){ print "<tr><td>$n</td><td>{$row['artist']}</td><td>{$row['title']}</td><td>{$row['genre']}</td></td><td><a href=\"playlist.php?remove=$n\">Delete</a></td></tr>"; // print whats returned from mysql and print the number it is in the file read from } $n = $n + 1; } print "</table></center>"; Pleas any help!
  4. I has trieed your code out,. it works fast 2 things it doesnt do the other does print $n for each result and list all in order of being read from the file file line1 line2 line3 when the result comes back mysql puts them in a order it knows which could be ASC or DESC but then you need a tag or id in the mysql database todo that.. here how the mysql returns it with the bit you gave me line2 line3 line1 here what i have as of now require('dbconfig1.php'); // connect to database $bad_symbols = array("'",","); // set bad symbols $linesgood = str_replace($bad_symbols,"",$lines); // remove bad symbols i was using mysql real escape but couldnt get it to work. print "<center><table border=1 frame=void cellpadding=1 cellspacing=0 align=center rules=all><tr><th>Song Position</th><th>Artist</th><th>Title</th><th>Genre</th></tr>"; while($n < count($linesgood)) { //get number of lines in file or array $query = mysqli_query($conn1, "SELECT * FROM mp_id3_tags WHERE filename LIKE '$linesgood[$n]'"); //query database for each one while($row = mysqli_fetch_array($query)){ print "<tr><td>$n</td><td>{$row['artist']}</td><td>{$row['title']}</td><td>{$row['genre']}</td></tr>"; // print whats returned from mysql and print the number it is in the file read from } $n = $n + 1; } print "</table></center>";
  5. Thanks for the help i added the no new line tag tot he file() and also have it strip the file of any colons or commas if i didnt do this i would get a error back from MYSQL i tried to use mysqli_real_escape_string but i couldnt get it to work right... but heres what i got and it works if anyone ever need a code like this. This code loads kinda slow im sure has todo with how many query's are being sent to the mysql server. anyone have a fix for that please post $lines = file("file", FILE_IGNORE_NEW_LINES); require('dbconfig1.php'); $bad_symbols = array("'",","); //set bad symbols $linesgood = str_replace($bad_symbols,"",$lines); // remove bad symbols i was using mysql real escape but couldnt get it to work. print "<cenetr><table><tr><th>whaetver colum1</th><th>whatever colum2</th></tr>"; while($n < count($linesgood)) { //get number of lines in file or array $recipeQuery = mysqli_query($conn1, "SELECT * FROM mp_id3_tags WHERE filename LIKE '$linesgood[$n]'"); //query database for each one while($recipeQuery1 = mysqli_fetch_array($recipeQuery)) { print "<tr><td>{$recipeQuery1['row1']}</td><td>{$recipeQuery1['row2']}</td></tr>"; } $n = $n + 1; } print "</table></center>"
  6. Hello, im looking for some help if anyone can be of help... i want to read from a file each line of that file, for each line search the database for that line found in the file and return what comes back, but i want it todo this for the whole file which could be up to 500 diffrent lines. what i have so far doesnt work ive tried a number of things including foreach() some of this could i got some somewhere else they said it worked for them. $lines = file("/var/www/htdocs/mp32/playlist.lst"); require('dbconfig1.php');//connect to db script while($n < count($lines)) { //get number of lines in file or array $recipeQuery = mysqli_query($conn1, "SELECT * FROM mp_id3_tags WHERE filename LIKE = '$lines[$n]'"); //query database for each one while($recipeQuery1 = mysqli_fetch_array($recipeQuery)) { print "{$recipeQuery1['artist']}"; } $n = $n + 1; }
×
×
  • 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.