I am attempting to call an external file and creating an array with it ... then feed that data into a mysql query, one at a time, and get the results from the query ...
Here's the code I'm trying to use to do it ...
Code: Select all
<?php
$dbhost= 'localhost';
$dbusername = 'user';
$dbpassword = 'pass';
$dbname = 'db';
$conn = mysql_connect($dbhost,$dbusername,$dbpassword);
mysql_select_db($dbname, $conn);
$lines = file('/home/user/public_html/test.txt');
foreach($lines as $data) {
$lists_result = mysql_query("SELECT ID FROM Email WHERE EmailAddress = '$data'", $conn);
$lists_data = mysql_fetch_array($lists_result);
echo $lists_data[ID];
}
};
?>Code: Select all
email@address1.com
email@address2.com
email@address3.com
etc ...What in the world am I doing wrong?? Any help would be appreciated ...