weird problem with mdb file

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
inhaler
Forum Newbie
Posts: 1
Joined: Sun Feb 13, 2011 3:09 pm

weird problem with mdb file

Post by inhaler »

I'm new here and wondering if somebody can help on this issue.

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);
?>
Last edited by Benjamin on Sun Feb 13, 2011 3:43 pm, edited 1 time in total.
Reason: Added [syntax=php] tags.
Post Reply