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
What are the Advantages and Application Areas of PHP?
What is php and what does it do?
Tell me how can we connect to a mysql database from a php script?
How to find the position of the first occurrence of a substring in a string?
Explain about the data types in PHP?
What is array function in javascript?
What is in a cookie?
How to convert a character to an ascii value?
What is the difference between single-quoted and double-quoted strings in php?
What does $_env means?
What are the array functions in php?
Explain the difference between $message and $$message?
What are the differences between GET and POST methods in form submitting?
What are the popular frameworks in php?
Why should I learn php?