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 is stdclass in php?
What is php in simple words?
What is the default time of cookie in php?
How does php strcmp work?
Can you pass an array into a function?
Does php pass arrays by reference?
What is php in full?
What is the difference between laravel and php?
What are the differences between GET and POST methods in form submitting?
What is substr() in php? And how it is used?
What is the use of mysql_real_escape_string() function?
What are Routines?
What happens when submit button is clicked?
What is difference between mysqli and mysql?
How can we change the maximum size of the files to be uploaded?