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

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

Contents of variable not echoing
Hey guys, hopefully this is an easy one...

In this line, the variables are not echoing out. T

Image upload - determine folder
I have an upload script that may be accessed from different directories. Problem is, the script is m

getting rid of quotes in strings
sick of trying to deal with them in multiple ways (entering in and taking from database, echoing, ec

Update data to upper case in parent/child tables
Hi Gurus!

In production we have a product table and which is being reference by many tabl

help removing unwanted graphic
How do I remove the small elongated rectangular shape between the "Latest post" and "

Query issues
I probably have this setup wrong well I know I do because nothing is showing up now. What I want is

show random images
hey guys

can someone please suggest a way in which the following code can be edited so it onl

A href problem under php
Hello...

I tried to explain the issue in an earlier post.. but was not clear enough....

email CODING Problem
Email coding problem.

I need to send a section of the info to $tf and the same as a Cc to $em

Problem with umlauts and UTF-8
Hello every1,

I'm creating my own little CMS at the moment and got some problems with the cha

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