Browsing articles tagged with

php techniques

40+ Useful Php tips for beginners – Part 3

Part 2 26. Avoid direct SQL query , abstract it $query = "INSERT INTO users(name , email , address , phone) VALUES('$name' , '$email' , '$address' , '$phone')"; $db->query($query); //call to mysqli_query() The above is the simplest way way of writing sql queries and interacting with databases for operations like INSERT, UPDATE, DELETE etc. But it has few drawbacks like: All values have to be ...

40+ Useful Php tips for beginners – Part 2

Part 1 11. Do not gzip output in your application , make apache do that Thinking of using ob_gzhandler ? No dont do that. It doesnt make sense. Php is supposed to write your application. Dont worry about how to optimise data transfer between server and browser inside Php. Use apache mod_gzip/mod_deflate to compress content via the .htaccess file. 12. Use json_encode when echoing ...

40+ Useful Php tips for beginners – Part 1

In this series we are going to look into some useful tips and techniques that can be used to improve and optimise your php code. Note that these php tips are meant for beginners and not those who are already using mvc frameworks etc. The Techniques 1. Do not use relative paths , instead define a ROOT path Its quite common to see ...



Connect with us