=== modified file 'prog_gallery.module'
--- prog_gallery.module	2009-03-11 10:47:58 +0000
+++ prog_gallery.module	2009-03-11 11:33:22 +0000
@@ -971,7 +971,7 @@
         // write back
         $exif_nr = 1;
         foreach ($exif_arr_nid as $key => $val) {
-          db_query("UPDATE {prog_gallery_images} SET `weight` = '". $exif_nr ."' WHERE `i_nid` = '". $val ."' ;") ;
+          db_query("UPDATE {prog_gallery_images} SET weight = %d WHERE i_nid = %d;", $exif_nr, $val) ;
           $exif_nr++;
         }
 
@@ -1305,8 +1305,8 @@
 
   if (!$nid) return $images;
 
-  $images_q = "SELECT n.nid, n.title, n.type, pg.weight, pg.exif_date FROM {node} n INNER JOIN {prog_gallery_images} pg ON n.nid = pg.i_nid WHERE pg.g_nid = ". $nid ." AND n.status = 1 ORDER BY pg.weight DESC";
-  $images_c = db_query($images_q);
+  $images_q = "SELECT n.nid, n.title, n.type, pg.weight, pg.exif_date FROM {node} n INNER JOIN {prog_gallery_images} pg ON n.nid = pg.i_nid WHERE pg.g_nid = %d AND n.status = 1 ORDER BY pg.weight DESC";
+  $images_c = db_query($images_q, $nid);
 
   while ($image_c = db_fetch_array($images_c)) {
     // if exif support is enabled, work with exif data

