Jump to content

Problem Removing bad symbols ` , '


dopey

Recommended Posts

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!

Link to comment
Share on other sites

$data is an array. mysqli_real_escape_string() takes a string as an argument, not an array. Also, why are you trying to remove commas and single quotes?

 

$query = mysqli_query($conn1, "SELECT * FROM mp_id3_tags WHERE filename LIKE '" . mysqli_real_escape_string($linesgood[$n]) . "'"); 

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.