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

Beginner’s Guide to OpenX Ad Server

I got an email from Packt Publishing to review a book that they will be releasing very soon (March 2010?). The book is about OpenX. In all honesty, I have not even tried to use OpenX Ad Server yet. Still, … Continue reading

Posted in General | Tagged , , , | Leave a comment

Zend Framework: How to use nested transactions with Zend_Db and MySQL

Steve Hollis first blog post about practical nested database transactions using Zend_Db. He writes really well and his blog is very readable. I love reading long text in Serif Thanks Steve! His solution: The Solution Disclaimer: This solution is adapted … Continue reading

Posted in General | Tagged , , , , | 4 Comments

MySQL: Doing calculations on dates excluding weekends

I recently had to calculate the amount of work done by an employee between a specific date range. My problem was that the calculation must exclude the weekends. I asked around (both Google and #mysql in IRC) and found out … Continue reading

Posted in General | Tagged , , , , | 3 Comments

A Follow-up on the Zend Framework Quickstart Tutorial: The Model

The model is probably the most difficult to concept to grasp in MVC (Read Surviving The Deep End). This post is very rough and un-editted and is based on my experience. I have gone through the new Zend Framework Quickstart … Continue reading

Posted in General | Tagged , , , , , , , | 5 Comments

MySQL: Get difference between 2 dates

Fairly simple and I’m sure this would come in handy in the future. This is one of those functions that I thought did not exist. I should RTFM more… SELECT DATEDIFF(’2009-03-31 23:59:59′,’2009-03-29′); /*would output: 2*/   /*Another usage would be … Continue reading

Posted in General | Tagged , | Leave a comment

Repost: UTF-8, PHP and MySQL

This is a repost from Akrabat.com The Problem:Get a £ (that is the pound sign) character stored to MySQL, retrieved and then displayed without any weird characters in front of it using UTF8. //for the browser//header("Content-type: text/html; charset=utf-8");//OR////then for MySQLmysql_set_charset(‘utf8′);//ormysqli_set_charset(‘utf8′);//or … Continue reading

Posted in General | Tagged , , | Leave a comment

Type casting in MySQL: Comparing string numbers and getting the right result

I recently ran into a problem where I had to compare “1000″ and “999″ — take note of the quotes, these values are strings. I did a SUBSTRING() in order to get those 2 strings, er “numbers”. In this SQL … Continue reading

Posted in General | Tagged , | 3 Comments

10 important MySQL variables that you should keep an eye on

A few months ago, I would have never read these kinds of posts. But after doing a project that had a huge MySQL database, I am glad that I have found this post. Regardless of whether you’re running a single … Continue reading

Posted in General | Tagged | Leave a comment

Importing from Huge CSV Files to MySQL Database and more…

The scenario: I am given a huge CSV File dumped thru FTP from some big JDE-ish system everyday. The CSV File is about 15MB or so. The file has around 60,000 lines in it. What I needed to do is … Continue reading

Posted in General | Tagged , , , , | 6 Comments

A Simple Recommendation System in MySQL

I am posting this because I know I will need this soon or later. I have built a simple recommendation for one of the websites I work with. It is only based on social relationships and does not take into … Continue reading

Posted in General | Tagged , | Leave a comment