foxymoron7
asked on
html table cutting off text at around 255 characters
Hi all,
I have a page that displays the results of a php query in an html table. My problem is data is getting cut off after about 255 characters in one of the columns of the html table. The column is a Memo field in an Access database that contains item descriptions that can be very long, longer than the 256 character limit of a text field.
I'm fairly certain that the problem is not with php because the full item description gets printed out when sent to an excel spreadsheet - there is an option to export the results of the query to an excel spreadsheet.
How can I get the full contents of the description field to display in the html table?
Thanks in advance.
I have a page that displays the results of a php query in an html table. My problem is data is getting cut off after about 255 characters in one of the columns of the html table. The column is a Memo field in an Access database that contains item descriptions that can be very long, longer than the 256 character limit of a text field.
I'm fairly certain that the problem is not with php because the full item description gets printed out when sent to an excel spreadsheet - there is an option to export the results of the query to an excel spreadsheet.
How can I get the full contents of the description field to display in the html table?
Thanks in advance.
You need to post your code. There is nothing intrinsic about table that cuts off the text. Your layout may be restricting it. But we won't know until we see some code.
ASKER
Code snippet below, sorry that html is all mixed up in php. If it helps, the table wraps the descriptions correctly so they cut off at various points, not at the right boundary of the table cell. The data terminates with a box containing FF FD in FireFox and terminates with no symbol in IE. I've put a Screencast below to illustrate (awesome tool by the way, thanks EE!)
Thanks.
Thanks.
echo "<table border='1' bordercolor='#DCDCDC' cellpadding='2'>";
echo "<tr> <th>Project</th> <th>Project Type and Team</th> <th>Address</th> <th>Scope of Work</th> <th>Facility Type</th> <th>Client</th> <th>Architect</th> <th>Start Date</th> <th>End Date</th> <th>Unescalated Value</th> </tr>";
while($row = odbc_fetch_array($result))
{
echo '<tr><td valign="top" align="left">';
if($keyword!=="%"){
$project_string = highlight($keywords, $row['Project']);
}
else{
$project_string = $row['Project'];
}
echo $project_string;
echo '</td><td valign="top" align="left">';
echo $row['Type_And_Team'];
echo '</td><td valign="top" align="left">';
echo '<a href="http://maps.google.com/?q='.$row['Address_Link'].'" target="_blank">'.$row['Address'].'</a>';
echo '</td><td valign="top" align="left">';
if($keyword!=="%"){
$scope_string = highlight($keywords, $row['Scope']);
}
else{
$scope_string = $row['Scope'];
}
echo $scope_string;
echo '<td valign="top" align="left">';
echo $row['Facility_Type'];
echo '</td><td valign="top" align="left">';
echo $row['Client'];
echo '</td><td valign="top" align="left">';
echo $row['Designer'];
echo '</td><td valign="top" align="right" width="70">';
if($row['Start_Date'] == "--" || $row['Start_Date'] == ""){
echo " ";
}
else {
echo $row['Start_Date'];
}
echo '</td><td valign="top" align="right" width="70">';
if($row['Completion_Date'] == "--" || $row['Completion_Date'] == ""){
echo " ";
}
else {
echo $row['Completion_Date'];
}
echo '</td><td valign="top" align="right">';
if($row['Job_Size']!=='0'){
echo number_format($row['Job_Value'], 0, '', ',') . '<br/>' . number_format($row['Job_Size'], 0, '', ',') . ' ' . $row['Unit'];
}
else{
if($row['Job_Value']>'0'){
echo number_format($row['Job_Value'], 0, '', ',');
}
else{
echo '';
}
}
echo '</td></tr>';
}
echo "</table>";
foxymoron7-371416.flv
I'm not sure if this has anything to do with your problem or not, but you're missing a closing td tag for the column that's truncated:
should be
echo '</td><td valign="top" align="left">';
if($keyword!=="%"){
$scope_string = highlight($keywords, $row['Scope']);
}
else{
$scope_string = $row['Scope'];
}
echo $scope_string;
echo '<td valign="top" align="left">';
should be
echo '</td><td valign="top" align="left">';
if($keyword!=="%"){
$scope_string = highlight($keywords, $row['Scope']);
}
else{
$scope_string = $row['Scope'];
}
echo $scope_string;
echo '</td><td valign="top" align="left">';
ASKER
Thanks, EmmyS! Unfortunately that didn't fix this problem but I bet it fixed one that I don't know about yet. :)
Could you post the rendered version of the code (i.e. view source and copy/paste the table code including cell content)? Also - Mac, PC, or *nix?
"FF FD" usually indicates a font or character set mismatch.
ASKER
New info, I printed the item description (Scope of Work) directly to the page (not in a table) below the table and the data still gets cut off. Evidence that the problem is not with HTML tables but possibly HTML in general or browser limitations? I'm going to download Opera and see if the problem happens there as well. I'll post back with results.
Page Source code:
Page Source code:
<table border="1" bordercolor="#DCDCDC" cellpadding="2">
<tr> <th>Project</th> <th>Project Type and Team</th> <th>Address</th> <th>Scope of Work</th> <th>Facility Type</th> <th>Client</th> <th>Architect</th> <th>Start Date</th> <th>End Date</th> <th>Unescalated Value</th> </tr>
<tr><td valign="top" align="left">City College of San Francisco - John Adams Campus Modernization<br/>#2005231</td>
<td valign="top" align="left"><span style="color: #999999">Job</span><br />CM: PP<br />PM: JL<br />ACCT: CH<br />ADMN: EB</td>
<td valign="top" align="left"><a href="http://maps.google.com/?q=1860 Hayes Street%20San Francisco%20CA%20" target="_blank">1860 Hayes Street<br />San Francisco, CA </a></td>
<td valign="top" align="left">Seismic upgrade and modernization of four-story building totaling approximately 136,000 square feet. The existing structure is composed of steel frame and partial concrete shear walls with an exterior brick finish. The building will be modernized to be c¿</td>
<td valign="top" align="left">Educational, College</td>
<td valign="top" align="left">City College of San Francisco (Jim Blomquist)</td>
<td valign="top" align="left">Paul Roberts (Paul Roberts & Partners, Inc.)</td>
<td valign="top" align="right" width="70">1-15-2008</td>
<td valign="top" align="right" width="70">10-16-2009</td>
<td valign="top" align="right">38,000,000<br/>133,209 SF</td>
</tr></table>
<br/>
Seismic upgrade and modernization of four-story building totaling approximately 136,000 square feet. The existing structure is composed of steel frame and partial concrete shear walls with an exterior brick finish. The building will be modernized to be c¿
Can you open item description (Scope of Work) in an editor and see what's after the "FF FD"? To make what you're expecting is still there?
ASKER
The source code above is from FireFox. Oddly IE 8 on Windows Server 2003 stops printing the source at the point the problem occurs while still rendering the entire page, but IE 7 on Windows XP prints the entire source code.
IE 7 source code below:
IE 7 source code below:
<table border="1" bordercolor="#DCDCDC" cellpadding="2">
<tr> <th>Project</th> <th>Project Type and Team</th> <th>Address</th> <th>Scope of Work</th> <th>Facility Type</th> <th>Client</th> <th>Architect</th> <th>Start Date</th> <th>End Date</th> <th>Unescalated Value</th> </tr>
<tr><td valign="top" align="left">City College of San Francisco - John Adams Campus Modernization<br/>#2005231</td>
<td valign="top" align="left"><span style="color: #999999">Job</span><br />CM: PP<br />PM: JL<br />ACCT: CH<br />ADMN: EB</td>
<td valign="top" align="left"><a href="http://maps.google.com/?q=1860 Hayes Street%20San Francisco%20CA%20" target="_blank">1860 Hayes Street<br />San Francisco, CA </a></td>
<td valign="top" align="left">Seismic upgrade and modernization of four-story building totaling approximately 136,000 square feet. The existing structure is composed of steel frame and partial concrete shear walls with an exterior brick finish. The building will be modernized to be c </td>
<td valign="top" align="left">Educational, College</td>
<td valign="top" align="left">City College of San Francisco (Jim Blomquist)</td>
<td valign="top" align="left">Paul Roberts (Paul Roberts & Partners, Inc.)</td>
<td valign="top" align="right" width="70">1-15-2008</td>
<td valign="top" align="right" width="70">10-16-2009</td>
<td valign="top" align="right">38,000,000<br/>133,209 SF</td>
</tr></table>
<br/>
Seismic upgrade and modernization of four-story building totaling approximately 136,000 square feet. The existing structure is composed of steel frame and partial concrete shear walls with an exterior brick finish. The building will be modernized to be c <!--</td></tr>
"<!--" is the beginning of an HTML comment, an area that is not supposed to show up on the screen.
ASKER
DaveBaldwin,
I'm not sure what you mean by openning it in an editor. I attached a text file that has copies from three sources: the webpage, the source code and the table view of the MS Access table. Let me know if that isn't what you meant.
As for the character set mismatch, I've explored that to some degree. I made sure that the browser was using the same character set called out in the page: <meta http-equiv="Content-type" content="text/html;charset =ISO-8859- 1">. I also experimented with rendering it in other character sets - various Westerns and Unicodes. No luck for me there.
Scope.txt
I'm not sure what you mean by openning it in an editor. I attached a text file that has copies from three sources: the webpage, the source code and the table view of the MS Access table. Let me know if that isn't what you meant.
As for the character set mismatch, I've explored that to some degree. I made sure that the browser was using the same character set called out in the page: <meta http-equiv="Content-type" content="text/html;charset
Scope.txt
ASKER
DaveBaldwin,
That is odd and I hadn't noticed it. The table is inside another table. The "big" table includes three form buttons and the "smaller" table that shows the query results. I was playing around with commenting out the "big" table to see if that was causing my problem. I've attached the original page below - before me playing around with it. Please have mercy on me if you try to read it. I can only imagine what you'll think of my very amateur abilities.
projectsearch-grid.php
That is odd and I hadn't noticed it. The table is inside another table. The "big" table includes three form buttons and the "smaller" table that shows the query results. I was playing around with commenting out the "big" table to see if that was causing my problem. I've attached the original page below - before me playing around with it. Please have mercy on me if you try to read it. I can only imagine what you'll think of my very amateur abilities.
projectsearch-grid.php
ASKER
DaveBaldwin,
Correction: it appears that I just had a table in a table... ? I don't know why so please don't ask. :)
Anyway, below is the new version without the extra table, the problem still occurs.
Side note: Line 372 starts a comment that I uncomment when I'm testing certain things. That comment is showing up in the browser view page source as well. Snippet below.
Correction: it appears that I just had a table in a table... ? I don't know why so please don't ask. :)
Anyway, below is the new version without the extra table, the problem still occurs.
Side note: Line 372 starts a comment that I uncomment when I'm testing certain things. That comment is showing up in the browser view page source as well. Snippet below.
(Continued from above...)
The building will be modernized to be c¿
<br />
<!--
<table width=100%>
<tr><td>
Query: SELECT IIf([Base_Job]<>'',IIf(pjmJobCustomFields.Full_Job_Name <> '', pjmJobCustomFields.Full_Job_Name, pjmJob.Description) & '<br/>#' & pjmJob.Job & '<br />' & '(Base Job - ' & [Base_Job] & ')',IIf(pjmJobCustomFields.Full_Job_Name <> '', pjmJobCustomFields.Full_Job_Name, pjmJob.Description) & '<br/>#' & pjmJob.Job) AS Project, pjmJobCustomFields.Type_of_Facility AS Facility_Type, ('<span style="color: #999999">' & pjmJobCustomFields.PCC_Project_Type & '</span>') & '<br />' & IIf(jcmJob.CM<>'', 'CM: ' & jcmJob.CM & '<br />','') & IIf(jcmJob.PM<>'','PM: ' & jcmJob.PM & '<br />', '') & IIf(jcmJob.PA<>'','ACCT: ' & jcmJob.PA & '<br />', '') & IIf(jcmJob.Admin<>'','ADMN: ' & jcmJob.Admin, '') AS Type_And_Team, IIf(pjmJob.[Scope_of_Work]<>'',pjmJob.[Scope_of_Work],' ') AS Scope, pjmJob.Address_1 & '<br />' & IIf(pjmJob.Address_2<>'',pjmJob.Address_2 & '<br />','') & pjmJob.[City] & ', ' & pjmJob.[State] & ' ' & pjmJob.[Postal_Code] AS Address, pjmJob.Address_1 & '%20' & pjmJob.CITY & '%20' & pjmJob.STATE &'%20' & pjmJob.Postal_Code AS Address_Link, IIf(pjmJobCustomFields.Client<>'', pjmJobCustomFields.Client, ' ') AS Client, IIf(pjmJob.Revised_Start_Date Is Not Null, FORMAT(pjmJob.Revised_Start_Date,'m') & '-' & FORMAT(pjmJob.Revised_Start_Date,'d') & '-' & FORMAT(pjmJob.Revised_Start_Date,'yyyy'), FORMAT(pjmJob.Estimated_Start_Date,'m') & '-' & FORMAT(pjmJob.Estimated_Start_Date,'d') & '-' & FORMAT(pjmJob.Estimated_Start_Date,'yyyy')) AS Start_Date, IIf([pjmJob].[Revised_Completion_Date] Is Not Null,FORMAT(pjmJob.Revised_Completion_Date,'m') & '-' & FORMAT(pjmJob.Revised_Completion_Date,'d') & '-' & FORMAT(pjmJob.Revised_Completion_Date,'yyyy'),FORMAT(pjmJob.Estimated_Completion_Date,'m') & '-' & FORMAT(pjmJob.Estimated_Completion_Date,'d') & '-' & FORMAT(pjmJob.Estimated_Completion_Date,'yyyy')) AS Completion_Date, pjmJobCustomFields.Approximate_Value AS Job_Value, [pjmJob.Size] AS Job_Size, pjmJob.Unit_Description AS Unit, IIf(architect.dPerson Is Null, IIf(architect.dCompany<>'', architect.dCompany, ' '), architect.dPerson & ' (' & architect.dPersonCompany & ')') AS Designer
FROM ((pjmJob
LEFT JOIN pjmJobCustomFields ON pjmJob.Job_Index = pjmJobCustomFields.Job_Index)
LEFT JOIN [(SELECT archContact.Job_Index, archPerson.Person_Name AS dPerson, persComp.Company_Name AS dPersonCompany, archCompany.Company_Name AS dCompany
FROM ((pjmJobContactList AS archContact LEFT JOIN abmPerson AS archPerson ON archContact.Contact_ID = archPerson.Contact_ID) LEFT JOIN abmCompany AS persComp ON archPerson.Company_Contact_ID = persComp.Contact_ID) LEFT JOIN abmCompany AS archCompany ON archContact.Contact_ID = archCompany.Contact_ID
WHERE (((archContact.Role)='Architect (Primary)')))]. AS architect ON pjmJob.Job_Index = architect.Job_Index)
LEFT JOIN jcmJob ON pjmJob.Job = jcmJob.Job
WHERE pjmJob.Job LIKE '2005231%' AND (pjmJob.Status<>'Closed') ORDER BY pjmJob.Job asc<br /></td></tr></table>
-->
projectsearch-grid.php
I looked at 'Scope.txt' and noticed that you're getting it from an Access database. Try changing your character set to 'Windows-1252' which I believe is the 'native' character set for Windows applications. It is not the same as ISO-8859-1.
<meta http-equiv="Content-type" content="text/html;charset=Windows-1252">
ASKER
Update:
Further playing has shown that I can get the entire text of the memo field to show up. I made test page with a simple 2 x 2 table. I printed the Scope of Work text directly to the page and I ran a very simple query in another cell that pulled back only the Scope of Work field. Both show the text in it's entirety. Test page code below.
Could the problem be with the overall size of the table in terms of either the data size or the size on the screen?
Further playing has shown that I can get the entire text of the memo field to show up. I made test page with a simple 2 x 2 table. I printed the Scope of Work text directly to the page and I ran a very simple query in another cell that pulled back only the Scope of Work field. Both show the text in it's entirety. Test page code below.
Could the problem be with the overall size of the table in terms of either the data size or the size on the screen?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-type" content="text/html;charset=ISO-8859-1">
<link rel="stylesheet" type="text/css" href="style.css">
<title>Argo - Project Search</title>
</head>
<body>
<table border="1">
<tr><td>
Seismic upgrade and modernization of four-story building totaling approximately 136,000 square feet. The existing structure is composed of steel frame and partial concrete shear walls with an exterior brick finish. The building will be modernized to be code compliant for accessibility, including upgrading existing restroom facilities, providing accessible entrances, and repairing all of the windows. The seismic upgrade to meet historic building code includes extensive façade upgrades, strengthening the interior diaphragms at each floor, and adding shotcrete shear walls. The building houses an educational facility with classrooms, and specialty rooms/laboratories serving medical classes as well as science, ESL, realty, computer labs, testing labs, a child-care center, and multi-use rooms. The work will be completed with one half of the building occupied and in use while construction proceeds in the remaining half. The project is seeking LEED Silver certification.
</td><td>
more stuff....
</td></tr>
<tr><td>
<?php
$dsn="Argo";
$user="";
$upasswd="";
$conn=odbc_connect($dsn,$user,$upasswd ) or die("Connection Error!");
$query="SELECT pjmJob.Scope_of_Work AS Scope
FROM pjmJob
WHERE (((pjmJob.Job)='2005231'))";
$result=odbc_exec($conn,$query);
if (!$result)
{exit("Error in SQL");}
while($row=odbc_fetch_array($result)){
echo $row['Scope'];
}
?>
</td><td>
Triceratops!!!
</td></tr>
</table>
</body>
</html>
I just looked at "projectsearch-grid.php" and the formatting is really wrong. The <body> tag should be right after the </head> tag and should occur only once. The '*.html' pages you are including should be only partial pages with only the code necessary for the task they are needed for. If they have their own <head> section, it will mess up the display of the page.
You also can't 'nest' forms like you have and expect them to work right.
You also can't 'nest' forms like you have and expect them to work right.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
or an HTML input box, or some type of FORM field, like a TEXT AREA. THOSE will truncate, but HTML tables cells will not.
ASKER
Looks like I have a lot to work on. It may take a day or two before I post results. Thank you all.
ASKER
Turns out MS Access truncates the memo field for various reasons, though I don't know which specific reason applies to my case. I found this article http://support.microsoft.com/kb/208801 and used Method #2 - Using the MID() function to split my memo field and then reassembled it when generating the table cell. Thanks to all for you help and patience.