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

need help with date function
i have following form for date

Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01

how to hide input fields on selection screen using variant attribute
Hello all,

I want to know how to hide input fields on selection screen using variant attr

want a code for uploading and downloading
i m trying to upload and download to my site..i need upload and download code ...i use a code for up

Wierd echo error?
Hi, i got the most wierd php error ever and i don't know why..
Code: echo "<t

parsing error
can anyone explain this syntax error:

Parse error: syntax error, unexpected T_IF

The e

Upload Code Help
Hi everyone I need some help with a bit of code ive been working with for a while. I am completely s

Trouble with a select list
Hello All!
I was wondering if any of you guys could help me with a small problem I'm having!

Simple MySQL script is not working
Hey guys,

Just familiarizing myself with PHP and MySQL. I am following along in the O'Reilly

Mail Form receiving emails with no content
Hi, I hope someone here can help me.
I have a simple form in my website, it was working OK, after

Get content from table into a list, without repeating.
Alright this is kinda an odd thing, so I need some help.

I have a table "quote" wit

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