54 echo "Error MYSQL:" . mysql_errno().": ".mysql_error()."<BR>"; |
54 echo "Error MYSQL:" . mysql_errno().": ".mysql_error()."<BR>"; |
55 } |
55 } |
56 |
56 |
57 while ($fila = mysql_fetch_row($resultat)) |
57 while ($fila = mysql_fetch_row($resultat)) |
58 $gent[$fila[0]] = array( "nom" => $fila[1], |
58 $gent[$fila[0]] = array( "nom" => $fila[1], |
59 "habitant" => $fila[2]); |
59 "habitant" => $fila[2], |
|
60 "id" => $fila[0]); |
60 return $gent; |
61 return $gent; |
61 } |
62 } |
62 |
63 |
63 function obtenir_compra($date,$connection) |
64 function obtenir_compra($date,$connection) |
64 { |
65 { |
190 } |
191 } |
191 |
192 |
192 echo "</SELECT>"; |
193 echo "</SELECT>"; |
193 } |
194 } |
194 |
195 |
|
196 function select_gent_multi($variable) |
|
197 { |
|
198 $num_gent = count($GLOBALS["gent"]); |
|
199 |
|
200 echo "<SELECT name=\"$variable"."[]\" multiple>\n"; |
|
201 |
|
202 foreach($GLOBALS["gent"] as $i) |
|
203 { |
|
204 echo "<OPTION value=\"" .$i["id"] . "\""; |
|
205 echo ">" . strtohtml($i["nom"]) . "\n"; |
|
206 } |
|
207 |
|
208 echo "</SELECT>"; |
|
209 } |
|
210 |
|
211 function select_botigues_multi($variable, $connection) |
|
212 { |
|
213 $resultat = mysql_query("SELECT botiga FROM compres GROUP BY botiga ORDER BY botiga ASC;", $connection); |
|
214 |
|
215 while ($fila = mysql_fetch_row($resultat)) |
|
216 $botigues[] = $fila[0]; |
|
217 $num_botigues = count($botigues); |
|
218 |
|
219 echo "<SELECT name=\"$variable". "[]\" multiple>\n"; |
|
220 |
|
221 foreach($botigues as $i) |
|
222 { |
|
223 echo "<OPTION value=\"" . strforquotes($i) . "\""; |
|
224 echo ">" . strtohtml($i) . "\n"; |
|
225 } |
|
226 |
|
227 echo "</SELECT>"; |
|
228 } |
|
229 |
|
230 |
195 function strtosql($cadena) |
231 function strtosql($cadena) |
196 { |
232 { |
197 return ereg_replace("\'", "\'", $cadena); |
233 return ereg_replace("'", "'", $cadena); |
198 } |
234 } |
199 |
235 |
200 function strtohtml($cadena) |
236 function strtohtml($cadena) |
201 { |
237 { |
202 $new= ereg_replace("[<]", "<", $cadena); |
238 $new= ereg_replace("[<]", "<", $cadena); |
203 $new= ereg_replace("[>]", ">'", $cadena); |
239 $new= ereg_replace("[>]", ">'", $cadena); |
204 $new= ereg_replace("[&]", "&'", $cadena); |
240 $new= ereg_replace("[&]", "&'", $cadena); |
|
241 |
|
242 return $new; |
|
243 } |
|
244 |
|
245 function strforquotes($cadena) |
|
246 { |
|
247 $new= ereg_replace("\"", ""es;", $cadena); |
|
248 |
|
249 return $new; |
|
250 } |
|
251 |
|
252 function strfromquotes($cadena) |
|
253 { |
|
254 $new= ereg_replace(""es;", "\"", $cadena); |
205 |
255 |
206 return $new; |
256 return $new; |
207 } |
257 } |
208 |
258 |
209 function pricetohtml($price) |
259 function pricetohtml($price) |