0
|
1 |
<?php
|
|
2 |
include("db-config.inc");
|
|
3 |
|
|
4 |
function obtenir_butxaques($connection)
|
|
5 |
{
|
|
6 |
$resultat = mysql_query("SELECT id,nom FROM butxaques ORDER BY nom ASC", $connection);
|
|
7 |
|
|
8 |
if (!$resultat)
|
|
9 |
{
|
|
10 |
?>
|
|
11 |
<p> <STRONG>ERROR:</STRONG> Error al obtenir
|
|
12 |
<STRONG>gent</STRONG>! </p>
|
|
13 |
<?php
|
|
14 |
echo "Error MYSQL:" . mysql_errno().": ".mysql_error()."<BR>";
|
|
15 |
}
|
|
16 |
|
|
17 |
while ($fila = mysql_fetch_row($resultat))
|
|
18 |
$butxaques[$fila[0]] = $fila[1];
|
|
19 |
return $butxaques;
|
|
20 |
}
|
|
21 |
|
|
22 |
// FUNCIONS PER GENERAR CODI HTML
|
|
23 |
|
|
24 |
function select_butxaques($variable, $default=-1)
|
|
25 |
{
|
|
26 |
global $butxaques;
|
|
27 |
|
|
28 |
echo "<SELECT name=\"$variable\">\n";
|
|
29 |
|
|
30 |
foreach(array_keys($butxaques) as $i)
|
|
31 |
{
|
|
32 |
echo "<OPTION value=\"" .$i . "\"";
|
|
33 |
if ($default == $i)
|
|
34 |
echo " selected";
|
|
35 |
echo ">" . strtohtml($butxaques[$i]) . "\n";
|
|
36 |
}
|
|
37 |
|
|
38 |
echo "</SELECT>";
|
|
39 |
}
|
|
40 |
|
|
41 |
function strforquotes($cadena)
|
|
42 |
{
|
|
43 |
$new= ereg_replace("\"", ""es;", $cadena);
|
|
44 |
|
|
45 |
return $new;
|
|
46 |
}
|
|
47 |
|
|
48 |
function strfromquotes($cadena)
|
|
49 |
{
|
|
50 |
$new= ereg_replace(""es;", "\"", $cadena);
|
|
51 |
|
|
52 |
return $new;
|
|
53 |
}
|
|
54 |
|
|
55 |
?>
|