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

need help in update query
hi
i have a dynamic form. i need help in how can i use update query when values from dynamic for

use an array from 1 class in a second class
I have a class that adds data to an array

Then I have a second class and I need to check if t

Searching keywords from array
Hello everyone, Im just wondering if someone could help me with another issue im having. Im still le

$get problem
Hi Guys ...

can you please tell me what i am doing wrong here
Code: <?php

Shuffle Array
Hi,

I am writing a script for a game that needs players to randomly be assigned a target (ano

filesize problem
i use ubuntu 9.10 and i have mountet a folder from an windows

/mount/FOLDER
/mount/FOLDER/

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

Better Method of a Member Cloud
I assume most people know how tag clouds work, where the tags most used are bigger and the least use

Problem with a select distinct
I have a problema with a select distinct, I have the next sql:

select distinct a,b,c,d fr

How to show the difference between two data field in a database with php.
Hello php gurus,

how r u all... i'm not so well facing a typical problem please help me...<

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