A web developer's blog. PHP, MySQL, CakePHP, Zend Framework, Wordpress, Code Igniter, Django, Python, CSS, Javascript, jQuery, Knockout.js, and other web development topics.

Tag Archives: MySQL

MySQL String Functions Made Easy – LEFT, SUBSTRING, RIGHT

Here is a quick tutorial: SELECT *, CONCAT(LEFT(DateRegular,4),"-",SUBSTRING(DateRegular,5,2),"-",RIGHT(DateRegular,2)) AS myDateRegularized FROM myCoolTableName WHERE ShortName NOT IN (SELECT employee_shortName FROM employee) AND LENGTH(DateRegular) >= 1 AND ( CONCAT(LEFT(DateRegular,4),"-",SUBSTRING(DateRegular,5,2),"-",RIGHT(DateRegular,2)) >= "2007-07-08" AND CONCAT(LEFT(DateRegular,4),"-",SUBSTRING(DateRegular,5,2),"-",RIGHT(DateRegular,2)) <= "2007-08-31" )

Posted in General | Tagged | 4 Comments

Very Simple PHP & MySQL Pagination

Here is a very simple tutorial to implement pagination using PHP and MySQL. Although this is not a fully working code, hopefully, the information provided here will be enough for most intermediate PHP programmers. $max = 10; $page = $_GET[’page’]; … Continue reading

Posted in Uncategorized | Tagged , | 4 Comments

MySQL native driver for PHP6 (mysqlnd)

That’s right, you heard me right: PHP6. Since PHP5 had very big improvements from PHP4, especially on the OOP side, I am already excited with the new stuff that will come with PHP6. And with this new addition (the mysqlnd … Continue reading

Posted in Uncategorized | Tagged , | Leave a comment

MySQL Triggers

Posted this here for personal reference. (For MySQL 5.0) Useful links for this post: MySQL String Functions Using MySQL Triggers Creating a MySQL Trigger MySQL Triggers FAQ DELIMITER //   CREATE TRIGGER mytest_trigger BEFORE INSERT ON mytest_table FOR EACH ROW … Continue reading

Posted in Uncategorized | Tagged | Leave a comment

SQL injection by example

I found this on digg.com. As quoted from the source: “SQL Injection” is subset of the an unverified/unsanitized user input vulnerability (“buffer overflows” are a different subset), and the idea is to convince the application to run SQL code that … Continue reading

Posted in Uncategorized | Tagged | Leave a comment