php addslas function help needed

Discussion in 'Programming' started by MrPJH, Jan 12, 2011.

  1. #1
    <?php
    $lines = file('file.txt');
    foreach($lines as $num => $line){
    $fullname = "name";
    $email=addslashes($line);
    $password = base64_encode(password);
    mysql_query("INSERT INTO table (fullname,email,password) VALUES('$fullname','$email','$password')") or die("Insert failed: " . mysql_error());
    }
    ?>
    
    PHP:
    please see the above code i want to add addslashes for $email but this is not doing in the way i mentioned above where i mistaken
    it do not gives any error
     
    MrPJH, Jan 12, 2011 IP
  2. underground-stockholm

    underground-stockholm Guest

    Messages:
    53
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I don't know what the exact problem is, but I do know that you're supposed to quote strings for SQL with mysql_real_escape_string() nowadays.
     
    underground-stockholm, Jan 13, 2011 IP