how to retrieve from database..... this format (PRMRMDU402).
firstname= prabhu, lastname=kumar, city=madurai,
pincode=624402....

i want first name first two letters and last name last two
letters ... city first two letters ... pin code last three
letters....

Answer Posted / gaurav

$record = mysql_fetch_array(".........");
$fn = substr($record['firstname'], 0, 2);
$ln = substr($record['lastname'], -2);
$ct = substr($record['city'], 0, 2);
$pc = substr($record['pincode'], -2);

$final = strtoupper($fn.$ln.$ct.$pc);

echo $final;

Is This Answer Correct ?    4 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why php is widely used?

555


How to include variables in double-quoted strings in php?

503


How to define a user function?

582


How values in arrays are indexed?

601


What is string function sql?

533






Can I learn php without knowing c?

563


What is php simple definition?

546


What does $_env means?

557


how to use http headers inside php? Write the statement through which it can be added?

511


What is the difference between single-quoted and double-quoted strings in php?

552


What is the use of session and cookies in php?

538


What is call by reference in php?

518


What is member function?

572


What are the 5 types of data?

571


What is the capacity of mysql database?

572