Place bold tags on last eight characters of query return
Posted: Sat Nov 14, 2009 7:38 am
I'm returning from a MySQL DB a vin # for a car and would like to highlight the last 8 characters. Looking for some clues as to where to start my research.
this would be ideal:
Many thanks
this would be ideal:
Code: Select all
<?php
$con = mysql_connect("DELETED");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("cars1", $con);
$result = mysql_query("SELECT * FROM cars WHERE id = $_POST[carid]");
while($row = mysql_fetch_array($result))
{
echo $row['VIN'];//Somehow just display the first 9 characters of $row['VIN']
?>
<strong>
<?
echo $row['VIN'];//Somehow just display the last 8 characters $row['VIN']
?>
</strong>