I have inserted couple of emails from a text file into database using mysqli. They get inserted though. Now when I am checking them back I am not getting any result.
Query for inserting emails from text file.
$query = "LOAD DATA LOCAL INFILE 'new.txt' INTO TABLE $table FIELDS TERMINATED BY '\n' (email)";
$result = mysqli_query($connection, $query) or trigger_error(mysqli_error($connection),E_USER_ERROR);
Query for checking them back using email not working.
$query = "SELECT email FROM $table WHERE email='email'";
$result = mysqli_query($connection, $query) or trigger_error(mysqli_connect_error(), E_USER_ERROR);
$row = mysqli_fetch_assoc($result);
$email = $row['email'];
echo $email.'<br >';
Query for checking them back using id is working.
$query = "SELECT email FROM $table WHERE id='1'";
$result = mysqli_query($connection, $query) or trigger_error(mysqli_connect_error(), E_USER_ERROR);
$row = mysqli_fetch_assoc($result);
$email = $row['email'];
echo $email.'<br >';
Output of this query shows a white space at the end of email but when I check in database there is no white space.
Please see why this is not working and suggest any possible way to do this.
Thanks