Gegen Bilderklau - Das Original (https://www.gegen-bilderklau.net/index.php)
- Design, Website, Copyright (https://www.gegen-bilderklau.net/board.php?boardid=80)
--- Homepagehilfe (https://www.gegen-bilderklau.net/board.php?boardid=27)
---- Homepagehilfe - Archiv (https://www.gegen-bilderklau.net/board.php?boardid=139)
----- [PHP & MySQL] Boxen mit einem Klick auswählen (https://www.gegen-bilderklau.net/thread.php?threadid=166902)


Geschrieben von schattenfell am 04.01.2010 um 20:22:

  Boxen mit einem Klick auswählen

Ich bin gerade dabei das "Boxenauswählen" zu coden. Ich möchte, dass wenn man auf "freie Box" klickt dann das Pferd was mit der id defininiert wird genau in die Box gestellt wird au die man vorher geklickt hat. Nun klappt das mit der Umsetzung noch nicht so wirklich, da meine Idee warscheinlich sowas von falsch und chaotisch ist (also bitte nicht über den code wundern) xD

Hier mal eine von den Stalldateien:

code:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
201:
202:
203:
204:
205:
206:
207:
208:
209:
210:
211:
212:
213:
214:
215:
216:
217:
218:
219:
220:
221:
222:
223:
224:
225:
226:
227:
228:
229:
230:
231:
232:
233:
234:
235:
236:
237:
238:
239:
240:
241:
242:
243:
244:
245:
246:
247:
248:
249:
250:
251:
252:
253:
254:
255:
256:
257:
258:
259:
260:
261:
262:
263:
264:
265:
266:
267:
268:
269:
270:
271:
272:
273:
274:
275:
276:
277:
278:
279:
280:
281:
282:
283:
284:
285:
286:
287:
288:
289:
290:
291:
292:
293:
294:
295:
296:
297:
298:
299:
300:
301:
302:
303:
304:
305:
306:
307:
308:
309:
310:
311:
312:
313:
314:
315:
316:
317:
318:
319:
320:
321:
322:
323:
324:
325:
326:
327:
328:
329:
330:
331:
332:
333:
334:
335:
336:
337:
338:
339:
340:
341:
342:
343:
344:
345:
346:
347:
348:
349:
350:
351:
352:
353:
354:
355:
356:
357:
358:
359:
360:
361:
362:
363:
364:
365:
366:
<?php 
session_start(); 
$username = $_SESSION["username"];

if(!isset($_SESSION["username"])) 
{ 
echo "Bitte erst <a href="login.htm">einloggen</a>"; 
exit; 
} 
include('db.php');

echo '<link rel="stylesheet" href="intern.css" type="text/css">';

$id = "$_GET[id]";

?>

<h1>Papiere bearbeiten</h1>
<br>
<p>Hier kannst du nun verschiedene Dinge rund um dein Pferd verwalten, wie z.B. 
einen Stall auswählen oder eine Reitbeteiligung suchen</p>
<p>&nbsp;</p>
<table cellpadding=3 cellspacing=1 class=tableinborder align=center width=450px>
<tr>
<?
$Ergebnis = mysql_query( "SELECT * FROM pferd where besitzer='$username' AND ID = '$id'" );
if (@mysql_num_rows($Ergebnis) == 0) {
echo "Du besitzt noch keine Pferde!";
}
else {
$Data = mysql_fetch_array( $Ergebnis );

echo"
<td class=titel width=20%><a href=stall.php?id=$Data[ID] target=main>Stall</a></td>
<td class=titel width=20%><a href=weide.php?id=$Data[ID] target=main>Weide</a></td>
<td class=titel width=20%><a href=rb.php?id=$Data[ID] target=main>Reitbeteiligung</a></td>
<td class=titel width=20%><a href=erfolge.php?id=$Data[ID] target=main>Turniererfolge</a></td>
<td class=titel width=20%><a href=futterplan.php?id=$Data[ID] target=main>Futterplan</a></td>
";
}
?></tr>
<tr>
<td colspan=6 class=hell>
<p><h1>Außenstall 1</h1>
<p align="center">Dies ist der 1. Außenstall. Ebenso wie der Hallenstall ist er 
recht neu. Im Gegensatz zu den beiden anderen besitzt er keine Paddocks, jedoch 
kann der obere Teil der äußeren Boxentür offen gelassen werden, sodass das 
Pferd zusätzlich Luft bekommt. Ebenso kann man sie so sowohl von innen als 
auch von außen öffnen.&nbsp; Zusätzlich verfügt dieser Stall über ein Solarium, eine 
Sattelkammer, eine Waschbox und eine Futterlager.<br>
Die 
monatliche Boxenmiete für diesen Stall beträgt 170€
<br>
<?
include("db.php");
$Ergebnis = mysql_query("SELECT * FROM pferd WHERE stall = 'Aussenstall 1'");
$anzahl = mysql_num_rows($Ergebnis);
$freieboxen = 16 - $anzahl;
?>
Es sind <b><? echo $freieboxen;?></b> von <b>16</b> Boxen  frei.
<br>
<br>
<img border="0" src="/Bilder/stallaussen1.png">
<br>
</p>

<p align="center">
<img border="0" src="/Bilder/stallinnen1.png">
<br>
<br>
<br>
<?
$id = "$_GET[id]";
$abfrage = "SELECT * FROM pferd WHERE ((besitzer = '$username') AND (ID = '$id'))";
$ergebnis = mysql_query($abfrage) or die(mysql_error()); ;
while($row = mysql_fetch_object($ergebnis))
{
echo"
<form method=get action=action_aussenstall1.php?id=$row->ID>
";
}
?>
<table width=450px align=center class=tableinborder>
<tr>
<td class=stroh width=150px height=150px>
<?php

$box = 1;

include("db.php");

$Ergebnis = mysql_query("SELECT * FROM pferd WHERE box = '1' AND stall = 'Aussenstall 1'");

     if (@mysql_num_rows($Ergebnis) == 0) {
    echo "<a href="action_aussenstall1.php?id=$Data[ID]" target=main>Freie Box</a>
    <input type=hidden name=box value=$box>";
    }

    else { 
        while($Data = mysql_fetch_array($Ergebnis)) {
                 echo "<a href="pferd.php?id=$Data[ID]" target=main>$Data[vorschauklein]</a>";
    }
}
?></td>
<td class=gasse rowspan=15>&nbsp;</td>
<td class=stroh width=150px height=150px>
<?php

$box = 2;

include("db.php");

$Ergebnis = mysql_query("SELECT * FROM pferd WHERE box = '2' AND stall = 'Aussenstall 1'");

     if (@mysql_num_rows($Ergebnis) == 0) {
    echo "<a href="action_aussenstall1.php?id=$Data[ID]" target=main>Freie Box</a>
    <input type=hidden name=box value=$box>";
    }

    else { 
        while($Data = mysql_fetch_array($Ergebnis)) {
                 echo "<a href="pferd.php?id=$Data[ID]" target=main>$Data[vorschauklein]</a>";
    }
}
?></td></tr>
<tr>
<td class=stroh width=150px height=150px>
<?php

include("db.php");

$Ergebnis = mysql_query("SELECT * FROM pferd WHERE box = '3' AND stall = 'Aussenstall 1'");

     if (@mysql_num_rows($Ergebnis) == 0) {
    echo "Freie Box";
    }

    else { 
        while($Data = mysql_fetch_array($Ergebnis)) {
                 echo "<a href="pferd.php?id=$Data[ID]" target=main>$Data[vorschauklein]</a>";
    }
}
?></td>
<td class=stroh width=150px height=150px><?php

include("db.php");

$Ergebnis = mysql_query("SELECT * FROM pferd WHERE box = '4' AND stall = 'Aussenstall 1'");

     if (@mysql_num_rows($Ergebnis) == 0) {
    echo "Freie Box";
    }

    else { 
        while($Data = mysql_fetch_array($Ergebnis)) {
                 echo "<a href="pferd.php?id=$Data[ID]" target=main>$Data[vorschauklein]</a>";
    }
}
?>
</td></tr>
<tr>
<td class=stroh width=150px height=150px><?php

include("db.php");

$Ergebnis = mysql_query("SELECT * FROM pferd WHERE box = '5' AND stall = 'Aussenstall 1'");

     if (@mysql_num_rows($Ergebnis) == 0) {
    echo "Freie Box";
    }

    else { 
        while($Data = mysql_fetch_array($Ergebnis)) {
                 echo "<a href="pferd.php?id=$Data[ID]" target=main>$Data[vorschauklein]</a>";
    }
}
?></td>
<td class=stroh width=150px height=150px><?php

include("db.php");

$Ergebnis = mysql_query("SELECT * FROM pferd WHERE box = '6' AND stall = 'Aussenstall 1'");

     if (@mysql_num_rows($Ergebnis) == 0) {
    echo "Freie Box";
    }

    else { 
        while($Data = mysql_fetch_array($Ergebnis)) {
                 echo "<a href="pferd.php?id=$Data[ID]" target=main>$Data[vorschauklein]</a>";
    }
}
?></td></tr>
<tr>
<td class=stroh width=150px height=150px><?php

include("db.php");

$Ergebnis = mysql_query("SELECT * FROM pferd WHERE box = '7' AND stall = 'Aussenstall 1'");

     if (@mysql_num_rows($Ergebnis) == 0) {
    echo "Freie Box";
    }

    else { 
        while($Data = mysql_fetch_array($Ergebnis)) {
                 echo "<a href="pferd.php?id=$Data[ID]" target=main>$Data[vorschauklein]</a>";
    }
}
?></td>
<td class=stroh width=150px height=150px><?php

include("db.php");

$Ergebnis = mysql_query("SELECT * FROM pferd WHERE box = '8' AND stall = 'Aussenstall 1'");

     if (@mysql_num_rows($Ergebnis) == 0) {
    echo "Freie Box";
    }

    else { 
        while($Data = mysql_fetch_array($Ergebnis)) {
                 echo "<a href="pferd.php?id=$Data[ID]" target=main>$Data[vorschauklein]</a>";
    }
}
?></td></tr>
<tr>
<td class=gasse width=150px height=150px><b><font color="#000000">Futterlager</font></b></td>
<td class=gasse width=150px height=150px><b><font color="#000000">Sattelkammer</font></b></td></tr>
<tr>
<td class=stroh width=150px height=150px><?php

include("db.php");

$Ergebnis = mysql_query("SELECT * FROM pferd WHERE box = '9' AND stall = 'Aussenstall 1'");

     if (@mysql_num_rows($Ergebnis) == 0) {
    echo "Freie Box";
    }

    else { 
        while($Data = mysql_fetch_array($Ergebnis)) {
                 echo "<a href="pferd.php?id=$Data[ID]" target=main>$Data[vorschauklein]</a>";
    }
}
?></td>
<td class=stroh width=150px height=150px><?php

include("db.php");

$Ergebnis = mysql_query("SELECT * FROM pferd WHERE box = '10' AND stall = 'Aussenstall 1'");

     if (@mysql_num_rows($Ergebnis) == 0) {
    echo "Freie Box";
    }

    else { 
        while($Data = mysql_fetch_array($Ergebnis)) {
                 echo "<a href="pferd.php?id=$Data[ID]" target=main>$Data[vorschauklein]</a>";
    }
}
?></td></tr>
<tr>
<td class=stroh width=150px height=150px><?php

include("db.php");

$Ergebnis = mysql_query("SELECT * FROM pferd WHERE box = '11' AND stall = 'Aussenstall 1'");

     if (@mysql_num_rows($Ergebnis) == 0) {
    echo "Freie Box";
    }

    else { 
        while($Data = mysql_fetch_array($Ergebnis)) {
                 echo "<a href="pferd.php?id=$Data[ID]" target=main>$Data[vorschauklein]</a>";
    }
}
?></td>
<td class=stroh width=150px height=150px><?php

include("db.php");

$Ergebnis = mysql_query("SELECT * FROM pferd WHERE box = '12' AND stall = 'Aussenstall 1'");

     if (@mysql_num_rows($Ergebnis) == 0) {
    echo "Freie Box";
    }

    else { 
        while($Data = mysql_fetch_array($Ergebnis)) {
                 echo "<a href="pferd.php?id=$Data[ID]" target=main>$Data[vorschauklein]</a>";
    }
}
?></td></tr>
<tr>
<td class=stroh width=150px height=150px><?php

include("db.php");

$Ergebnis = mysql_query("SELECT * FROM pferd WHERE box = '13' AND stall = 'Aussenstall 1'");

     if (@mysql_num_rows($Ergebnis) == 0) {
    echo "Freie Box";
    }

    else { 
        while($Data = mysql_fetch_array($Ergebnis)) {
                 echo "<a href="pferd.php?id=$Data[ID]" target=main>$Data[vorschauklein]</a>";
    }
}
?></td>
<td class=stroh width=150px height=150px><?php

include("db.php");

$Ergebnis = mysql_query("SELECT * FROM pferd WHERE box = '14' AND stall = 'Aussenstall 1'");

     if (@mysql_num_rows($Ergebnis) == 0) {
    echo "Freie Box";
    }

    else { 
        while($Data = mysql_fetch_array($Ergebnis)) {
                 echo "<a href="pferd.php?id=$Data[ID]" target=main>$Data[vorschauklein]</a>";
    }
}
?></td></tr>
<tr>
<td class=stroh width=150px height=150px><?php

include("db.php");

$Ergebnis = mysql_query("SELECT * FROM pferd WHERE box = '15' AND stall = 'Aussenstall 1'");

     if (@mysql_num_rows($Ergebnis) == 0) {
    echo "Freie Box";
    }

    else { 
        while($Data = mysql_fetch_array($Ergebnis)) {
                 echo "<a href="pferd.php?id=$Data[ID]" target=main>$Data[vorschauklein]</a>";
    }
}
?></td>
<td class=stroh width=150px height=150px><?php

include("db.php");

$Ergebnis = mysql_query("SELECT * FROM pferd WHERE box = '16' AND stall = 'Aussenstall 1'");

     if (@mysql_num_rows($Ergebnis) == 0) {
    echo "Freie Box";
    }

    else { 
        while($Data = mysql_fetch_array($Ergebnis)) {
                 echo "<a href="pferd.php?id=$Data[ID]" target=main>$Data[vorschauklein]</a>";
    }
}
?></td></tr>
<tr>
<td class=gasse width=150px height=150px><b><font color="#000000">Solarium</font></b></td>
<td class=gasse width=150px height=150px><b><font color="#000000">Waschbox</font></b></td></tr>
</table>
</td></tr></table></form>


Bitte nicht irrietieren lassen, ich hab das bis jetzt erstmal nur an den ersten beiden Boxen getestet


und action_aussenstall1.php:

code:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
<?php
session_start();
$username = $_SESSION["username"];
extract($_POST);
if(!isset($_SESSION["username"]))
{
echo "Bitte erst einloggen";
exit;
}
echo '<link rel="stylesheet" href="intern.css" type="text/css">';

$id = "$_GET[id]";

   include('db.php'); 
   
$box = $_GET['box'];
  
 $aendern = "UPDATE pferd SET stall = Außenstall 1, box = '$box' WHERE besitzer = '$username' AND ID = '$id'"; 
              $update = mysql_query($aendern);              
             
   if($aendern==true) { 
   
         echo "Deine Daten wurden erfolgreich geändert"; 
          
         }  
else { 
         echo mysql_error(); 
      } 
       
?> 


ansonsten würde ich mich über alternative vorschläge sehr freuee, ich zerbreche mir schon den ganzen tag den kopf darüber wie man die idee umsetzen könnte

liebe grüße;
schattenfell



Geschrieben von schattenfell am 04.01.2010 um 20:29:

  RE: Boxen mit einem Klick auswählen

nein eine erfolgsmldung sogar, aber updaten tut natürlich nicht. die getfunktion funktioniert auch nicht, also wird halt nicht drangehangen



Geschrieben von schattenfell am 04.01.2010 um 20:46:

  RE: Boxen mit einem Klick auswählen

also dsa mit den boxen in jede zeile wo die gnazen abfragen bei mir sind?
was es mit dem extract auf sich hat weiß ich nicht, das ist aus dem logintut von php-einfach. ich hab dioch mal in icq geaddet


Forensoftware: Burning Board, entwickelt von WoltLab GmbH