Hi. Please could someone help me understand what's happening here.
I have a MySQL database which has a table with some data in the following format:
2022-03-15 06:55:39:<br/>LineOfSight:<br/>java.lang.Exception:<br/> UNAVAILABLE TELEMETRY BR$0
The field collation is utf8 and the data is stored as text.
This data is provided via a 3rd party API so I have no control over input format. I simply want to echo that line of data but the page chokes and never loads when I run my query. The query runs fine directly in phpMySQL as well as in Toad for MySQL and MySQL workbench so it has to be a PHP parsing issue.
My code:
$serialnumber = 123456;
$sql = "SELECT rmAlarms.instruct,
rmAlarms.technical
FROM qpsdf_db1.rmAlarms rmAlarms
WHERE (rmAlarms.serialnumber = '$serialnumber')";
$database->setQuery($sql);
$result = $database -> loadObjectList();
foreach ($result as $key => $results){
$technical = htmlentities($results->technical);
$instruct = htmlentities($results->instruct);
echo $technical;?><br><?php
echo $instruct;?><br><?php
}
The field in question is rmAlarms.technical
If I comment out the relevant fields as below then the query works and the data is returned correctly.
$serialnumber = 123456;
$sql = "SELECT rmAlarms.instruct,
rmAlarms.technical
FROM qpsdf_db1.rmAlarms rmAlarms
WHERE (rmAlarms.serialnumber = '$serialnumber')";
$database->setQuery($sql);
$result = $database -> loadObjectList();
foreach ($result as $key => $results){
//$technical = htmlentities($results->technical);
$instruct = htmlentities($results->instruct);
//echo $technical;?><br><?php
echo $instruct;?><br><?php
}
I have tried using:
$technical = htmlentities($results->technical);
As well as:
$technical = $results->technical;
both with the same results.
What am I missing? Any insight appreciated.