Solved

limit out put only first 50 leter php mysql

Posted on 2008-06-16
1
169 Views
Last Modified: 2013-12-12
   <td><?php echo $row_Recordset1['BilDetProName']; ?></td>

In the code above how can i set up to show only 50 first leter in the cell in case it have more than 50 leter
for printing purpose
<?php require_once('../Connections/localhost.php'); 

mysql_select_db($database_localhost, $localhost);

$query_Recordset1 = "SELECT * FROM billingdetail WHERE BilDetRef = 31";

$Recordset1 = mysql_query($query_Recordset1, $localhost) or die(mysql_error());

$row_Recordset1 = mysql_fetch_assoc($Recordset1);

$totalRows_Recordset1 = mysql_num_rows($Recordset1);

?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>Untitled Document</title>

<style type="text/css">

<!--

.style2 {

	font-size: 14px;

	font-weight: bold;

}

.style3 {color: #000000; font-size: 9px; }

-->

</style>

</head>
 

<body>

<table width="699" border="0">

  <tr>

    <td colspan="2"> <div align="center"><span class="style2"> &#3651;&#3610;&#3648;&#3626;&#3619;&#3655;&#3592;&#3619;&#3633;&#3610;&#3648;&#3591;&#3636;&#3609; / &#3651;&#3610;&#3585;&#3635;&#3585;&#3633;&#3610;&#3616;&#3634;&#3625;&#3637; RECEIPT / TAX INVOICE </span> <em>&#3605;&#3657;&#3609;&#3593;&#3610;&#3633;&#3610;&#3621;&#3641;&#3585;&#3588;&#3657;&#3634;</em></div></td>

  </tr>

  <tr>

    <td width="456" class="style3"><span class="style2">&#3610;&#3619;&#3636;&#3625;&#3633;&#3607; &#3626;&#3617;&#3640;&#3618; &#3648;&#3588;&#3648;&#3610;&#3636;&#3657;&#3621; &#3607;&#3637;&#3623;&#3637; &#3592;&#3635;&#3585;&#3633;&#3604;</span></td>

    <td width="233" class="style2"><span class="style3">&#3648;&#3621;&#3586;&#3611;&#3619;&#3632;&#3592;&#3635;&#3605;&#3633;&#3623;&#3612;&#3641;&#3657;&#3648;&#3626;&#3637;&#3618;&#3616;&#3634;&#3625;&#3637;&#3629;&#3634;&#3585;&#3619; 3 821 018544 </span></td>

  </tr>

  <tr>

    <td class="style3">45/1-2 &#3627;&#3617;&#3641;&#3656; 1 &#3605;&#3635;&#3610;&#3621;&#3649;&#3617;&#3656;&#3609;&#3657;&#3635; &#3629;&#3635;&#3648;&#3616;&#3629;&#3648;&#3585;&#3634;&#3632;&#3626;&#3617;&#3640;&#3618; &#3592;&#3633;&#3591;&#3627;&#3623;&#3633;&#3604;&#3626;&#3640;&#3619;&#3634;&#3625;&#3598;&#3619;&#3660;&#3608;&#3634;&#3609;&#3637;&#3650;&#3607;&#3619;.(077) 425004-5 Fax &#3605;&#3656;&#3629; 18 </td>

    <td class="style2">&#3648;&#3621;&#3586;&#3607;&#3637;&#3656;</td>

  </tr>

  <tr>

    <td class="style3">&#3609;&#3634;&#3617; Name/&#3607;&#3637;&#3656;&#3629;&#3618;&#3641;&#3656; Address</td>

    <td class="style2">&#3623;&#3633;&#3609;&#3607;&#3637;&#3656;</td>

  </tr>

  <tr>

    <td colspan="2">&nbsp;</td>

  </tr>

  <tr>

    <td colspan="2">&nbsp;</td>

  </tr>

</table>

<table width="692" border="0">

  <tr>

    <td width="10">&nbsp;</td>

    <td width="277"><div align="center">Description</div></td>

    <td width="50">unit</td>

    <td width="70">unit/price</td>

    <td width="70">total</td>

  </tr>

  <tr>

    <td>1</td>

    <td><?php echo $row_Recordset1['BilDetProName']; ?></td>

    <td><?php echo $row_Recordset1['BilDetQua']; ?></td>

    <td><?php echo $row_Recordset1['BiDelPrice']; ?></td>

    <td>&nbsp;</td>

  </tr>

<tr>

    <td>&nbsp;</td>

    <td>&nbsp;</td>

    <td>&nbsp;</td>

    <td>&nbsp;</td>

    <td>&nbsp;</td>

  </tr>

  <tr>

    <td>&nbsp;</td>

    <td>&nbsp;</td>

    <td>&nbsp;</td>

    <td>&nbsp;</td>

    <td>&nbsp;</td>

  </tr>

  <tr>

    <td>&nbsp;</td>

    <td>&nbsp;</td>

    <td>&nbsp;</td>

    <td>&nbsp;</td>

    <td>&nbsp;</td>

  </tr>

  <tr>

    <td>&nbsp;</td>

    <td>&nbsp;</td>

    <td>&nbsp;</td>

    <td>&nbsp;</td>

    <td>&nbsp;</td>

  </tr>

  <tr>

    <td colspan="4">&nbsp;</td>

    <td>&nbsp;</td>

  </tr>

  <tr>

    <td colspan="3" class="style2">Remark</td>

    <td>&nbsp;</td>

    <td>&nbsp;</td>

  </tr>

  <tr>

    <td colspan="4">&nbsp;</td>

    <td>&nbsp;</td>

  </tr>

</table>

<p>&nbsp;</p>

</body>

</html>

<?php

mysql_free_result($Recordset1);

?>

Open in new window

0
Comment
Question by:teera
1 Comment
 
LVL 48

Accepted Solution

by:
hernst42 earned 400 total points
ID: 21800139
use

<td><?php echo substr($row_Recordset1['BilDetProName'],0,50); ?></td>
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article discusses how to create an extensible mechanism for linked drop downs.
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now