My code shown below will successfully return an array of values using print_r. How can I can get each value to be inserted into SQL Server "on its own row" in the same column? So far, I have only been able to get the first value in the array to be written to my table. The additional value(s) are not written. Thx, _ JT
$host = '209.49.180.234';
$hostname = gethostbyaddr( $host );
$rbl = 'hostkarma.junkemailfilter.com';
$lookup = $hostname . '.' . $rbl;
$value = gethostbynamel($lookup);
if ($lookup != $value){
print_r($value);
}
I am unclear where to insert the loop. Like this?:
$host = '209.49.180.234';
$hostname = gethostbyaddr( $host );
$rbl = 'hostkarma.junkemailfilter.com';
$lookup = $hostname . '.' . $rbl;
$value = gethostbynamel($lookup);
if ($lookup != $value)
foreach($value as $val) {
mssql_query("INSERT INTO $table5 (Whitelist_code) VALUES ('".$val."')");
}
mssql_close($conn);
I got it to work. Thanks guys! _ JT