Archive | MySQL RSS feed for this section

[How To]Use user-defined variable in MySQL LIMIT clause

TweetRecently, I got a situation where I needed to select only the first 50% (half) records from a database table. The constraint was that I could not use programming language to add a variable to the MySQL limit clause. Under normal circumstances the code would look something like this PLAIN TEXT PHP: // Connect to [...]

Read full story · Comments { 0 }

[HowTo] Backup and Restore MySql Databases

TweetDo you have a backup of your important mysql databases ? No ? Think about it .. What if you have a Operating System / Filesystem crash ? What if your databases get corrupted due to some reason ? What if you accidentally drop your database or some important tables ? What if you want [...]

Read full story · Comments { 2 }

SQL data source in Sphinx

TweetThese days I am getting more and more into Sphinx and falling in love with it . In this post we will see how to make use of SQL data source to create indexes. Sphinx has inbuilt support for MySQL and PostgreSQL databases. The drivers for these databases can connect to the database using its [...]

Read full story · Comments { 1 }

The longer Lithium Blog tutorial using MySQL – Part 2

TweetIn the previous article, we learned how to setup Lithium and create a simple blog to add/edit/delete posts. Now, we will see how to add comments to the post and display them back on post view page. Unfortunately, Lithium doesn't support relationships yet, so we will query the comments table on our own. Let us [...]

Read full story · Comments { 3 }