I need to make a php web crawler and this part of the web crawler doesn't work. It should make a file where it shows the password from the corresponding email that is in email_list.txt
and that is in my database
$fh = fopen('user_data.txt', 'w');
$con = mysql_connect("localhost","root","");
mysql_select_db("userdata", $con);
/* insert field values into data.txt */
$content = explode("\n", file_get_contents('email_list.txt'));
$content2 = implode(" ", $content);
$result = mysql_query(" SELECT `password` FROM `users` WHERE `email` = '' ");
while ($row = mysql_fetch_array($result)) {
$last = end($row);
$num = mysql_num_fields($result) ;
for($i = 0; $i < $num; $i++) {
fwrite($fh, $row[$i]);
if ($row[$i] != $last)
fwrite($fh, ", ");
}
fwrite($fh, "\n");
}
fclose($fh);
i expected the password to be generated in the .txt
file but its just empty