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

How can I Compare two xml documents?
Hi all,

I am doing a POC for my project and I am using XE database 10g version.

Include with Parameters
In a particular page I would like to include a file that requires $_GET parameters.

when I go

update 2 columns by doing inner 2-column query
Hi,
is something like this possible?

update contract_all set col1,col2 =
(

A WBS element with the name XXX already exists in version FREI_VERSION
Hi.
When I am trying to insert WBS element in a project, error occurs:

"A WBS eleme

php redirecting
i wont open a new thread but i have a question about redirecting....
i wonder why my code doesnt

Array disappearing in foreach loop
Okay, I have this problem where an array will become undefined in a foreach loop.

Here is the

Multi-user card game
I'm writing a batch of games and such. Lottery is finished, Poker,blackjack,etc are next. They will

reating a background image
I am building a site in drupal and have a php form in it, due to certain annoyances with module buil

Inserting 100x and 100y coordinates in mysql table - easy
Is there a way to insert this data into a mysql table named 'map' with the fields: 'x int 3' , 'y in

small inaccuracies
I have this code to convert fractional base 10 into base 2:

while($num > 0)

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