--- a/getdb.inc Wed May 10 23:58:52 2006 +0200
+++ b/getdb.inc Thu May 11 00:00:15 2006 +0200
@@ -56,7 +56,8 @@
while ($fila = mysql_fetch_row($resultat))
$gent[$fila[0]] = array( "nom" => $fila[1],
- "habitant" => $fila[2]);
+ "habitant" => $fila[2],
+ "id" => $fila[0]);
return $gent;
}
@@ -192,9 +193,44 @@
echo "</SELECT>";
}
+ function select_gent_multi($variable)
+ {
+ $num_gent = count($GLOBALS["gent"]);
+
+ echo "<SELECT name=\"$variable"."[]\" multiple>\n";
+
+ foreach($GLOBALS["gent"] as $i)
+ {
+ echo "<OPTION value=\"" .$i["id"] . "\"";
+ echo ">" . strtohtml($i["nom"]) . "\n";
+ }
+
+ echo "</SELECT>";
+ }
+
+ function select_botigues_multi($variable, $connection)
+ {
+ $resultat = mysql_query("SELECT botiga FROM compres GROUP BY botiga ORDER BY botiga ASC;", $connection);
+
+ while ($fila = mysql_fetch_row($resultat))
+ $botigues[] = $fila[0];
+ $num_botigues = count($botigues);
+
+ echo "<SELECT name=\"$variable". "[]\" multiple>\n";
+
+ foreach($botigues as $i)
+ {
+ echo "<OPTION value=\"" . strforquotes($i) . "\"";
+ echo ">" . strtohtml($i) . "\n";
+ }
+
+ echo "</SELECT>";
+ }
+
+
function strtosql($cadena)
{
- return ereg_replace("\'", "\'", $cadena);
+ return ereg_replace("'", "'", $cadena);
}
function strtohtml($cadena)
@@ -206,6 +242,20 @@
return $new;
}
+ function strforquotes($cadena)
+ {
+ $new= ereg_replace("\"", ""es;", $cadena);
+
+ return $new;
+ }
+
+ function strfromquotes($cadena)
+ {
+ $new= ereg_replace(""es;", "\"", $cadena);
+
+ return $new;
+ }
+
function pricetohtml($price)
{
if ($price < 0)