This piece of program read out news story from a Access .mdb file. somehow if the story is very long (say > 4000 chars), it will just display only part of the story. I verified that the story is completed saved in the mdb file, but it is not read out fully. Everything else is fine. No errors. It's connected through ODBC.
Any input will be appreciated!
Code: Select all
<?php
$conn=odbc_connect('news','','');
if($_GET["id"]=="")
{
$sql="SELECT top 10 expire, id, newsdate, newstitle from tblnews where active = 1 and #".date("m/d/Y")."# < expire order by newsdate desc, id;";
$rs=odbc_exec($conn,$sql);
echo "</br>";
while (odbc_fetch_row($rs)) {
echo substr(odbc_result($rs,"newsdate"),0,11)." <a href=newsmodule?id=".odbc_result($rs,"id")." style='text-decoration: none;'>".odbc_result($rs,"newstitle")."</a><br />";
}
}
else
{
$sql="SELECT id, newsdate, newstitle, newsbody from tblnews where id =".$_GET["id"];
$rs=odbc_exec($conn,$sql);
if (!$rs)
{exit("Error in SQL");}
echo "<br /><div style='font-size: 16px; color: #900;'>".odbc_result($rs,"newstitle")."</div>";
echo substr(odbc_result($rs,"newsdate"),0,11)."<br /><br />";
echo odbc_result($rs, "newsbody");
}
odbc_close($conn);
?>