Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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



how to retrieve from database..... this format (PRMRMDU402). firstname= prabhu, lastname=kumar, cit..

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

how to retrieve from database..... this format (PRMRMDU402). firstname= prabhu, lastname=kumar, cit..

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

Post New Answer

More PHP Interview Questions

Do loops php?

0 Answers  


What is the default time in seconds for which session data is considered valid?

0 Answers  


How do functions work?

0 Answers  


Tell me can the value of a constant change during the script's execution?

0 Answers  


Explain the purpose of output buffering in php.

0 Answers  


What is the tags in PHP is not a valid way to begin and end a PHP code block?

0 Answers  


Xplain is it possible to use com component in php?

0 Answers  


How can we get the properties (size, type, width, height) of an image using PHP image functions?

4 Answers   ConSim,


How can we optimize or increase the speed of a mysql select query?

6 Answers  


What is printf in php?

0 Answers  


How many data types are there in php?

0 Answers  


How to create the PHP Script to Calculate the Age Using the Inputs Of our Birth date and the Current date?

6 Answers  


Categories