October 6, 2008

MySQL Select Optimization line

Weather used in php or any other scripting language… sometimes we have the need to query a database in order to fetch or manipulate certain data. One of the most common request, widely written and used is SELECT * FROM MyTable WHERE ID='ValueX' and NAME='ValueY'; now, ID and NAME are just columns… so nothing special However.. how could someone optimize that line of code? Fact is, lots of coders out there, do not realize how unoptimize this line could be and the different problems it could generate. ... Read more

October 6, 2008

10 tips to optimize your PHP code

if you were to use between print or echo… use echo (Echo is known to be faster than print) when doing string searches or action, do not simply/quickly jump on regex, but first have a look at php api’s string functions such as strpbrk, stripos etc.. Display smart error messages… A lot of young developers like to display a custom error or show systems errors whenever something break. Although it is good practice to alert the user of any error, keep in mind printing Error cost a lot in resources. ... Read more