Solved

limit out put only first 50 leter php mysql

Posted on 2008-06-16
1
182 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

Question has a verified solution.

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

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

719 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