//$sInsert = "Insert into {mbAttendees} (name,zip,level) values ('$name','$zip','$level')";
//drupal_set_message($sInsert);
//$ret = db_query($sInsert);
// Do it this way to defeat SQL injection.
$sInsert = "Insert into {mbAttendees} (name,zip,level) values ('%s','%s','%s')";
db_query($sInsert, $name, $zip, $level);
This parries SQL injection, where a malicious or unlucky user can enter SQL particles instead of bonafide data like a name that, if engineered just right against the SQL in your code, can trick the database engine into executing unexpected or even damaging code. The parameterized version of db_query() generally reduces to the simpler version, except that certain characters like apostrophes are escaped. That way, whatever the user enters is passed on to the database verbatim, so SQL trickiness is defeated. mysql_real_escape_string() in straight PHP does much the same. The writeup at Wikipedia is enlightening.MATC's Drupal class takes up all aspects of Drupal Open Source development, starting with installation, configuration, and base features. Core functions and modules are addressed, including users, content types, themes, menus, and jQuery. Module development with PHP is the central topic, including with the form API against MySQL. Students should be familiar with HTML and CSS and be ready to program in PHP. This course is a general elective for the Internet Developer Certificate, but interested special students are welcome.
Class: Drupal Development-IDC (152-187, class #64826) Where: Madison Area Technical College, Truax campus When: Tues-Thurs, 5:30 pm - 6:20 pm (lab the previous hour) Starts: January 12, 2010 Ends: May 13, 2010 Cost: $336.75 Contact: Mike Bertrand
Click "Read more" for my pitch from last summer for MATC to teach a Drupal class, something we started doing in August 2008. You never know in the IT business, but events seem to have confirmed the analysis. The first thing anyone should do who really wants to know what makes Drupal tick is to view principal Dries Buytaert's video from DrupalCom last March (2009) in Washington, DC. When I saw this video, I happened to be reading Ursula Le Guin's The Dispossessed, an epic novel about self-regulating communities with themes strikingly reminiscent of those Dries' touched on.