--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/getdb.inc Thu May 18 23:47:03 2006 +0200
@@ -0,0 +1,55 @@
+<?php
+ include("db-config.inc");
+
+ function obtenir_butxaques($connection)
+ {
+ $resultat = mysql_query("SELECT id,nom FROM butxaques ORDER BY nom ASC", $connection);
+
+ if (!$resultat)
+ {
+?>
+ <p> <STRONG>ERROR:</STRONG> Error al obtenir
+ <STRONG>gent</STRONG>! </p>
+<?php
+ echo "Error MYSQL:" . mysql_errno().": ".mysql_error()."<BR>";
+ }
+
+ while ($fila = mysql_fetch_row($resultat))
+ $butxaques[$fila[0]] = $fila[1];
+ return $butxaques;
+ }
+
+ // FUNCIONS PER GENERAR CODI HTML
+
+ function select_butxaques($variable, $default=-1)
+ {
+ global $butxaques;
+
+ echo "<SELECT name=\"$variable\">\n";
+
+ foreach(array_keys($butxaques) as $i)
+ {
+ echo "<OPTION value=\"" .$i . "\"";
+ if ($default == $i)
+ echo " selected";
+ echo ">" . strtohtml($butxaques[$i]) . "\n";
+ }
+
+ echo "</SELECT>";
+ }
+
+ function strforquotes($cadena)
+ {
+ $new= ereg_replace("\"", ""es;", $cadena);
+
+ return $new;
+ }
+
+ function strfromquotes($cadena)
+ {
+ $new= ereg_replace(""es;", "\"", $cadena);
+
+ return $new;
+ }
+
+?>