i'm having problems while querying for mysql "text" data.
here's my code:
$result_odg = mysqli_query($con,"SELECT * FROM agenda WHERE data = '" . $today . "' AND odg IS NOT NULL");
echo "<h4>ODG:</h4>";
if (mysqli_fetch_array($result_odg)) {
$i = 1;
echo "<table id=\"agenda_odg\">";
while($row = mysqli_fetch_array($result_odg)) {
if($i % 2 == 0)
$cellID = "even";
else
$cellID = "odd";
echo "<tr id=" . $cellID . "><td>" . $row['testo'] . "</td></tr>";
$i == $i++;
}
echo "</table>";
} else {
echo "No ODG";
}
the table have the following fields: id, data_ins, data, testo, odg, agenda, ok.
using any other name than "testo" in $row['testo']
(example $row['id']
) will print out the text. is there any special query to do for "TEXT" type fields? maybe because it's too heavy and needs a particular array? can't find anything about this on the manual...
please use
// no need to fetch the result for check (shorten runtime time)
if ($result_odg) {
while($row = mysqli_fetch_assoc($result_odg)) {
// use $row['testo'] is possible
// replace this too
$i++;
}
}
To make query fast select only those fields which needed.In this case your query should be like:
$result_odg = mysqli_query($con,"SELECT testo FROM agenda WHERE data = '" . $today . "' AND odg IS NOT NULL");