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

a dificult string search
Hi I don't know a way around this. I want the user to input a password, but to make it a bit complca

Two warning messages
Quote<b>Warning</b>: mysql_real_escape_string() expects parameter 1 to

question about n
I was looking at some of the things you could do with php and one of the things I have tried is n.<

Sessions work for me and not others?
I'm having a bit of bad luck with sessions. In the past they have worked fine for me, but this time

How to separate records and ORDER BY
Let say i have 100 records and displayed in one page, then i want to get the records from 50-100 and

Prevent PHP mail( ) from appending hostname to from address
Hey guys,

I want to be able to send texts to phones via email (since each phone has their own

EU VAT Package 2010
Does any one know whether SAP will be developing new reporting functionality due the new VAT rules t

jquery validation in codeIgniter
hai i need to add client side validation to my fiels which are selected in a forloop.the fields are

fopen() security
As i understood the usage of fopen() for it to function correctly the Dir you write to has to be rw

Allowing ' and "
Hello everyone,

I am creating a form where users submit information to go into a database. 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