Tuesday 12 August 2014

Mysql get multi row value in get single field

Table : user
--------------
| Id | Name  |
--------------
|  1 | Test  |
|  2 | Test1 |
|  3 | TEst2 |
|  4 | Test3 |
|  5 | Test4 |
|  6 | Test5 |
|  7 | Test6 |
--------------

Query :
select group_concat(concat(id) SEPARATOR ',') from user

Output:
1,2,3,4,5,6,7

Friday 8 August 2014

To improve PHP Programming tip in 10 steps

1. Use an SQL Injection Cheat Sheet
2. Know the Difference Between Comparison Operators
3. Shortcut the else
4. Drop those Brackets
5. Favour str_replace() over ereg_replace() and preg_replace()
6. Use Ternary Operators
7. Memcached
8. Use a Framework
9. Use the Suppression Operator Correctly
10. Use isset instead of strlen

To find disk space for my computer & server in php

disk_free_space("directory");