Formatting echo from database


Posted on 16th Feb 2014 07:03 pm by admin

So I have a database that stores First and last names, then echos them back to a website, as of now the entire first and last name echos back (John Smith) I want the last name to just display the last letter and a . (John S.) here's my code for echoing the database

Code: <?PHP
$res = mysql_query("SELECT id, DATE_FORMAT(date, '%M %D %Y') as dt, firstname, lastname, testimonial FROM testimonials ORDER BY date DESC LIMIT 10");
Did you know?Explore Trending and Topic pages for more stories like this.

while ($row = mysql_fetch_assoc($res)) {
echo "<p align="right"><i>{$row['firstname']} {$row['lastname']}<br />{$row['dt']}</i></p><br /><br />{$row['testimonial']}<br /><hr width="80%" color="#000000"><br />";
}
?>
No comments posted yet

Your Answer:

Login to answer
222 Like 38 Dislike
Previous forums Next forums
Other forums

$variable $variables type question
I need to be able to designate an array element dynamically, so I thought to use a variable variable

Applet JTextField Size Problem
Hello,

I recently started making an applet to calculate certain values for airplanes. However

limitations on array_unique()
Does any one know what/how imitations are applied to array_unique? I have an issue where no matter h

upload photo limits
ive got a upload photo script and im just trying to make more secure currently it limits size and as

Timer control causing error
I recently decided to add a timer control to an existing page that uses AJAX on my site. As soon as

DELETE rows based on content
I have a link in my rows

$bit="http://bit.ly/abcd";
$query = mysql_query("D

Email to a friend script problems
I have this send-to-a-friend script with 2 issues:


1) When you open the form popup on a p

sql error
I have been looking at this code for 20mins and can't work out what I am doing wrong. There is somet

DirectoryIterator and Hacked Website
Hi Everyone.

My problem:
Some one has been sneaking in to my website hidden Iframes. I've

Feed Maker
Hi all.
First of all I must say I am not a php developer so I am afraid I don't know much about i

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash