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....
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / ajit
SELECT SUBSTRING(`firstname`,1,2) as 'firstname',SUBSTRING
(`lastname`,-2) as 'lastname',SUBSTRING(`city`,1,2) as
'city',SUBSTRING(`pincode`,-3) as 'pincode' FROM
`user_info` WHERE 1
| Is This Answer Correct ? | 0 Yes | 0 No |
Can you explain, when to use if-else if-else over switch statements?
What are the advantages of php mysql?
What is a persistent cookie in php?
Do you know what does $globals means?
Write a program to find no of days between two dates in php?
why header() gives the error like header already sent in php please explain in brief
How check field is empty or not in php?
i have a string and that string contains the alphanumeric value and i want to hide or semihide the 10 digit telephone number from the string.
Which function can be used to exit from the script after displaying the error message?
What is null value in php?
Which functions are used to remove whitespaces from the string?
How many types of array are there in php?