Archive for the ‘PHP’ Category

How to retrieve data from database using AJAX in PHP

 

To download code – Click Here

To retrieve data from MYSQL or any database using AJAX, you need to do the following steps

Step 1

Create a database db_test and add one table named test with the following fields

name

username

department

phone


Read more »

String Formatting : length, count and occurrences in PHP

 

Lower to Upper

<?php
$str = "Mary Had A Little Lamb and She LOVED It So";
$str = strtoupper($str);
echo $str; // Print ==> MARY HAD A LITTLE LAMB AND SHE LOVED IT SO
?>
 
Upper to Lower
 
<?php
$str = "Mary Had A Little Lamb and She LOVED It So";
$str = strtolower($str);
echo $str; // Print ==> mary had a little lamb and she loved it so
?>
 
Capitalise First Character
 
<?php
$foo = 'hello world!';
$foo = ucfirst($foo);
echo $foo; // Print ==> Hello world!
?>
 

Read more »