[PHP & MySQL] Shop & Konto Frage

MissFreaky
Ich bin derzeit am Shop und habe dazu den Code vom vrh Adventskalender umgeschrieben.

Klappt alles super. Nur eine einzige Sache möchte ich anders haben. Der Kontostand wird in der konto_username.txt überschrieben. Wie mache ich das, dass der Kontostand in der Datenbank in der Tabelle 'mitglieder' bei 'konto' überschrieben wird und nicht in der txt datei?

php:
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:

<?php
session_start();
?> 


      <?php
   include('db.php');
      $id $_GET['id'];
      $abfrage "SELECT * FROM mitglieder WHERE id = ".$_SESSION["login"];
      $ergebnis mysql_query($abfrage);
      $Data mysql_fetch_array($ergebnis);
      ?>

<? $obj=$HTTP_POST_VARS['obj'];
$obe=$HTTP_POST_VARS['obe'];
$obe2=$HTTP_POST_VARS['obe2'];
$price=$HTTP_POST_VARS['price'];
if($obe != ""){$obe= "&nbsp;".$obe.",";}
// Code von Unicorn/N. Heppler. Verändern und Verwenden auf Webseiten erlaubt, solange dieser Verweis drin bleibt. 


$datei = fopen("konto_$Data[name].txt","a+");
$kstand = fgets($datei);

$neukstand= $kstand - $price;

$dateix = fopen("konto_$Data[name].txt","w+");
fwrite($dateix, $neukstand);
fclose($dateix);
$datei = fopen("zub_$Data[name].htm","a+");
$neuinh="<br>$obj ($obe $obe2)";
fwrite($datei, $neuinh);
fclose($datei);

?>

<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>Neue Seite 1</title>
<link rel="stylesheet" href="http://calvano.bplaced.de/lmain.css">
</head>

<body>
<p align="center" class="head">Shop</p>
<br>


<table border="0" cellpadding="5" cellspacing="0" width="424" style="font-family: Verdana; font-size: 12px; border-style: dotted; border-width: 1">
<tr>
<td align="center" >
Zubehör erfolgreich eingekauft. <br> <br> Dein Kontostand betrug vorher <? echo $kstand;?> V€ <br>
Nun hast du noch <? echo $neukstand;?> V€ auf dem Konto <br> <br>
<a href="zub_<? echo $Data[name];?>.htm"> Meine Zubehörliste ansehen</a> <br> <br>
<a href="intern.php"> zurück zum Internbereich</a> <br>

</td> 
</td> 
</tr>
</table> 


</body>
</html>

                <?php
            }

        include("footer.php");
?>


Liebe Grüße,
missfreaky
MissFreaky
Und diesen Codeteil dann komplett weglassen !?

php:
1:
2:
3:
4:
5:
6:
7:
8:
$datei fopen("konto_$Data[name].txt","a+");
$kstand fgets($datei);

$neukstand$kstand $price;

$dateix fopen("konto_$Data[name].txt","w+");
fwrite($dateix$neukstand);
fclose($dateix);

Oder was muss ich davon ändern bzw. stehenlassen?


Weil, wie mach ich das denn wenn ich unten den alten und neuen Kontostand ausgeben möchte, denn ich hab doch dann nur den neuen Stand gespeichert oder verwirrt

lg,
missfreaky
MissFreaky
Dankeschön, klappt super fröhlich