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 factory pattern in php?
Can you explain, when to use if-else if-else over switch statements?
What type of operation is needed when passing values through a form or an url?
Which array function checks if the particular key exists in the array?
How to insert a line break in php string?
What is array function in javascript?
How to create an array of a group of items inside an html form?
What does the scope of variables means?
How do sessions work in php?
What is data type in php?
Do you know what's the difference between __sleep and __wakeup?
Write a statement to show the joining of multiple comparisons in php?
What is a closure in php?
What is csrf validation?
Explain NULL?