Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 396
  • Last Modified:

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.
0
foxymoron7
Asked:
foxymoron7
  • 10
  • 6
  • 2
  • +1
1 Solution
 
Dave BaldwinFixer of ProblemsCommented:
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.
0
 
foxymoron7Author Commented:
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.

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 "&nbsp";
				}
				else {
				echo $row['Start_Date'];
				}
		echo '</td><td valign="top" align="right" width="70">';
			if($row['Completion_Date'] == "--" || $row['Completion_Date'] == ""){
				echo "&nbsp";
				}
				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, '', ',') . '&nbsp;' . $row['Unit'];
			}
			else{
				if($row['Job_Value']>'0'){
					echo number_format($row['Job_Value'], 0, '', ',');
					}
					else{
					echo '';
					}
			}
		echo '</td></tr>';
	}

echo "</table>";

Open in new window

foxymoron7-371416.flv
0
 
EmmySCommented:
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:

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">';

Open in new window


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">';

Open in new window

0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
foxymoron7Author Commented:
Thanks, EmmyS!  Unfortunately that didn't fix this problem but I bet it fixed one that I don't know about yet.  :)
0
 
EmmySCommented:
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?
0
 
Dave BaldwinFixer of ProblemsCommented:
"FF FD" usually indicates a font or character set mismatch.
0
 
foxymoron7Author Commented:
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:

<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&nbsp;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¿

Open in new window

0
 
Dave BaldwinFixer of ProblemsCommented:
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?
0
 
foxymoron7Author Commented:
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:

<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&nbsp;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>

Open in new window

0
 
Dave BaldwinFixer of ProblemsCommented:
"<!--" is the beginning of an HTML comment, an area that is not supposed to show up on the screen.
0
 
foxymoron7Author Commented:
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
0
 
foxymoron7Author Commented:
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
0
 
foxymoron7Author Commented:
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.

(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],'&nbsp') 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, '&nbsp') 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, '&nbsp'), 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>
-->

Open in new window

projectsearch-grid.php
0
 
Dave BaldwinFixer of ProblemsCommented:
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">

Open in new window

0
 
foxymoron7Author Commented:
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?

 
<!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>

Open in new window

0
 
Dave BaldwinFixer of ProblemsCommented:
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.
0
 
scrathcyboyCommented:
To get you back to track of reality, you can put a MILLION characters into a single table cell, and NOT one character will ever be truncated.  It does not matter if this table cell is inside 100 other tables, it MAKES NO DIFFERENCE.  Everything will show.

The only HTML feature that will truncate the contents of a table cell on screen is if you have a DIV or a SPAN or some other newer non-table HTML element that is enclosing the table and should not be.

Look for DIV or SPAN enclosing the table.  That could cause this.  Otherwise, it HAS TO BE in the parsing of the data, transferring via PHP or some other DATABASE feature that is truncating the output.  HTML tables will never do that.
0
 
scrathcyboyCommented:
or an HTML input box, or some type of FORM field, like a TEXT AREA.  THOSE will truncate, but HTML tables cells will not.
0
 
foxymoron7Author Commented:
Looks like I have a lot to work on.  It may take a day or two before I post results.  Thank you all.
0
 
foxymoron7Author Commented:
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.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 10
  • 6
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now