I have two results/outputs from a couple of scripts.
Script 1 result:
print_r($unit);
OUTPUT =
Array ( [0] => http://one.com, [1] => http://two.com, [2] => http://three.com/, )
Script 2 result:
echo $item."<br>";
OUTPUT =
http://one.com,
http://two.com,
http://three.com,
I'm embarrassingly failing to failing to import either one into a MySQL table which has just two fields: ID and URL.
//Connect to MySQL...
// Attempt insert query execution
$list=implode($unit);
$sql = "INSERT INTO urls (url) VALUES ('$list')";
if(mysqli_query($conn, $sql)){
echo "Records added successfully.";
} else{
echo "ERROR: Could not able to execute $sql. " . mysqli_error($conn);
}
// Close connection
mysqli_close($conn);
The insert works but the code is inserting all 3 urls into a single field:
id url
1 http://one.com,http://two.com,http://three.com,
DESIRED MySQL table result for both script 1 and 2:
id url
1 http://one.com
2 http://two.com
3 http://three.com
THANKS for your thoughts!
$list=implode(",", $unit);try that out.