select

Drupal CCK form field - US states list

If you're ever creating a Drupal form using the CCK module and need to show a list of states (the United States) in a combo box (also known as a "select list" or "drop down" field), you'll want to have that list of states in the right format.

Fortunately (for you) I just ran into this problem, and created two different versions of CCK form state fields. This first one displays the full name of the state, and stores the two-digit state code in the database:

A Drupal form states dropdown field (list of states) example

I was just working on a Drupal form, and I wanted to include a list of states (the United States) in a dropdown field (an HTML select/options field). Knowing that I'll need this list of states for other Drupal applications, I decided to put the "states" code in a separate file.

To that end I put this list of states in a file named states.inc, in the same directory with the rest of my Drupal module code:

A Scala JDBC connection and SQL SELECT example

Scala JDBC FAQ: How can I use the Java JDBC API in my Scala application?

If you want to use a SQL database with your Scala applications, it's good to know you can still use the traditional Java JDBC programming library to access databases. I just ran a simple JDBC connection and SQL SELECT test, and everything seems to work just as it does in Java.

A Drupal 7 SQL cheat sheet

I'm currently developing a new Drupal 7 application (technically built as a new Drupal module), and as I'm building the application, I've made notes on database queries I've made.

The approach I'm taking is to use the following Drupal SQL query functions. As you can see from the function names, there are now different Drupal functions for each query type:

A Drupal 7 table with sortable headers and pager

In my previous blog post I wrote about how to create an HTML table in a Drupal 7 module form. As promised in that tutorial, once I figured out how to make the table columns sortable, I'd share that secret recipe as well. Here then is how to make an HTML table in a Drupal 7 module/form:

A Drupal form select/options field example (dropdown box)

Drupal form FAQ: How do I create an HTML SELECT/OPTIONS field in a Drupal form?

Solution: If you'd like to create an HTML SELECT field (a dropdown box) in a Drupal form that looks something like this:

A Drupal 7 form SELECT OPTIONS field example

there are at least two ways to do so.

MySQL show users - how to show the users in a MySQL database

MySQL users FAQ: How do I show MySQL users (How do I show user accounts I've created in a MySQL database)?

To show/list the users in a MySQL database, first log into your MySQL server as an administrative user, then run this MySQL query:

Java MySQL examples and tutorials

Today was mostly a day off for me, but I thought I'd do one thing here to help organize the website a little better. To that end, I've put together a list of the Java MySQL examples I've created, i.e., Java database examples that were specifically written for MySQL.

iPhone web apps - the HTML SELECT element

iPhone HTML/web apps FAQ: Can I use the HTML SELECT tag in my iPhone HTML web apps? If so, what does the control look like in the iPhone Mobile Safari web browser?

Yes, according to the Apple Safari web developer documentation, you can use the HTML SELECT tag in your iPhone HTML/web apps.

Case insensitive SQL SELECT query examples

Case insensitive SQL SELECT query FAQ: How do I issue SQL SELECT queries while ignoring case (ignoring whether a string is uppercase or lowercase)?

When I first started writing SQL queries, I did some pretty crazy things to try to ignore case in my text/string queries. Unfortunately for me, I first started with Postgresql, and used some of their custom regular expression capabilities. That seemed like a good idea at the time, but when I tried to move my application to a MySQL database, I paid a price in having to rewrite my case-insensitive SQL queries.

Syndicate content