First, here's some code:
$result = mysql_query("SELECT standard FROM thestandards WHERE id={$theSearch}", $connection);
if (!$result) {
die("Database connection failed: " . mysql_error());
}
while ($row = mysql_fetch_array($result)) {
$query = $row[0];
}
// echo $testing = nl2br($query);
$subStrings = explode('\n', $query);
echo $subStrings[0] . "<br />"; // outputs entire query
echo $subStrings[1] . "<br />"; // undefined offset
echo $subStrings[2] . "<br />"; // undefined offset
echo $subStrings[3] . "<br />"; // undefined offset
So, the data I'm retrieving from the database is several small paragraphs. I want to take these paragraphs, separate them, and put them into an array. I tried using the explode function with the newline char, but for some reason it doesn't work. I can get it to work if I want to go explicitly add "\n"s in the database everywhere, but that just doesn't seem practical. nl2br doesn't work for what I need, but I find it interesting that this function is somehow able to "see" all the newlines in the query, whereas the explode function cannot. Explode is really what I need, but I've tried '\n', '\r', '\r\n' and nothing works. Thanks for the help.