I’ve made a temp site to try out a script I’m adapting upon (simple website monitoring script)
However only the very last site added in that array seems to be recognised as a valid URL, as the others are not queried at all. If you edit one of the added sites in the middle of the array, and then save, it will query no problem.
My first impression is to do with the encoding of the textarea/MySQL query/PHP Array..or something else.
I’ve set the textarea to UTF8, and HTML, and also in the MySQL query.
$hostnames = explode("\n", $_POST['hostnames']);
while ($i < count($hostnames)) {
$a = $hostnames[$i];
$sql = "INSERT INTO blah blah blah";
mysql_query("SET NAMES 'utf8'", $con);
mysql_query($sql,$con);
$i++;
}
Any ideas where I’m going wrong along the way? This is my first useful PHP project, so it’s quite a steep learning curve.
Thanks,
Oli
1) You dont need mysql_query(“SET NAMES ‘utf8′”, $con); at every loop (set it once).
2) try ‘\r\n’