Brugernavn:




Kodeord: Husk
Forside Forum Artikler Downloads Søg
 

Query indsætter to rows ?

Hej Rowl, sider og river håret ud på mig selv lige nu kan simpelt hen ikke finde ud at at rette denne fejl jeg har:

Når jeg køber et Ansigt i butikken så uploader min query 2 ansigter :O?

Lidt Kode:
  1. echo"<center><font color='#000000' face='Papyrus' size='2'>Confirm Purchase</font></center>";
  2.                     $get_face = mysql_query("SELECT * FROM vipfaceshop_faces WHERE id = ".$_GET['id']."")or die(mysql_error());
  3.                     $face = mysql_fetch_assoc($get_face);
  4.                         $credits = $ppfc - $face['price'];
  5.                         mysql_query("UPDATE users SET pfcredits = '$credits' WHERE user_id = '$pid'")or die(mysql_error());
  6.                         mysql_query("INSERT INTO user_faces(user_id, face_id, vipface) values('$pid', ".$face['id'].", 'Yes')")or die(mysql_error());
  7.                         echo "You have succesfully bought the face<br />";
  8.                         echo "<a href='VIPFaces'>Return</a>";

På forhånd tak Toli :)
Oprettet af:

MySQL

Point afsat: 10

Åben
18:05 15/12/2009
det ligner os at din query vil udføres når din side åbner og så igen når du har postet. (sån ligner det ud fra din tekst)
Oprettet af:

Kommentar
18:32 15/12/2009
Du er da nød til at hente nogle oplysninger fra din form evt.
Oprettet af:

Kommentar
18:34 15/12/2009
Gørr jeg også m4rc :)


Hele koden :
  1. <?php session_start(); include("includes/config.php"); php?>
  2. <!DOCTYPE html PUBLIC "-// W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <head><style type="text/css">
  5. .menutitle{
  6. cursor:pointer;
  7. margin-bottom: 5px;
  8. background-color:#ECECFF;
  9. color:#000000;
  10. width:140px;
  11. padding:2px;
  12. text-align:center;
  13. font-weight:bold;
  14. /*/*/border:1px solid #000000;/* */
  15. }

  16. .submenu{
  17. margin-bottom: 0.5em;
  18. }
  19. </style>

  20. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  21. <title>Project Fansite - v1.0 By Toli & Joe</title>
  22. <link href="../global.css" rel="stylesheet" type="text/css" />
  23. </head>

  24. <body>
  25. <div id="container">
  26.     <div id="banner">
  27.         <?
  28.         include("includes/banner stats.php");
  29.         ?>
  30.     </div>

  31.     <div id="djsays">
  32.         <?
  33.         include("includes/menu.php");
  34.         ?>
  35.     </div>

  36.     <div id="middle">
  37.         <div id="left">
  38.             <div id="navigation_top"></div>
  39.             <div id="small_middle" style="width: 231; height: 24">
  40.             <div id="masterdiv">
  41.             <?
  42.             include("includes/user_menu.php");
  43.             ?>
  44.             </div>
  45.             </div>
  46.             <div id="small_bottom"></div>
  47.             
  48.             <div id="online_top"></div>
  49.             <div id="small_middle" style="width: 231; height: 16">
  50.             <?
  51.             include("includes/online.php");
  52.             ?>
  53.             </div>
  54.             <div id="small_bottom"></div>
  55.             
  56.             <div id="radio_top"></div>
  57.             <div id="small_middle" style="width: 231; height: 16">
  58.             <?
  59.             include("includes/radio.php");
  60.             ?>
  61.             </div>
  62.             <div id="small_bottom"></div>

  63.             <div id="disclaimer_top"></div>
  64.             <div id="small_middle" style="width: 231; height: 12">
  65.               <div align="left">
  66.               <?
  67.               include("includes/adds.php");
  68.               ?>
  69.               </div>
  70.               <div align="left">
  71.               </div>
  72.               &nbsp;</div>
  73.             <div id="small_bottom"></div>
  74.         </div>

  75.         <div id="centre">
  76.             <div id="content_top"></div>
  77.             <div id="content_middle" style="width: 428; height: 27">
  78.             <?
  79.             // Checks if user is logged on
  80.             if($_SESSION['project_user'] === "yes"){
  81.                 if($pvip == 1){
  82.                 ?>
  83.                 <center><font color="#000000" face="Papyrus" size="2">Vip Face Shop</font></center>
  84.                 <br />
  85.                 Welcome to the VIP face shop, here you can buy special faces only buyable to VIP's.
  86.                 The VIP Face Shop is always open, and is owned buy Project Fansite.
  87.                 </div>
  88.                 <div id="content_bottom"></div>
  89.                 <br />
  90.                 <div id="content_top"></div>
  91.                 <div id="content_middle" style="width: 428; height: 27">
  92.                 <?
  93.                 if(empty($_GET['buy'])){ ?>
  94.                 <center><font color="#000000" face="Papyrus" size="2">Faces:</font></center>
  95.                 <table width="99%" cellpadding="0" cellspacing="0" style="border1px solid #000000">
  96.                 <?
  97.                 $color1 = "#EAEAEA";
  98.                 $color2 = "#F0F0F0";
  99.                 $row_count = 0;
  100.                 $get_faces= mysql_query("SELECT * FROM vipfaceshop_faces ORDER BY id ASC")or die(mysql_error());
  101.                 while($faces = mysql_fetch_assoc($get_faces)){
  102.                     $row_color = ($row_count % 2) ? $color1 : $color2;
  103.                     ?>
  104.                     <tr>
  105.                     <td width="50px"><img src="<? echo $faces['path']; ?>" /></td><td style="background-color:<? echo $row_color; ?>">Name: <? echo $faces['name']; ?> &nbsp;Price: <? echo $faces['price']; ?><a href="faceshopvip.php?buy=yes&id=<? echo $faces['id']; ?>" style="float:right;">» Buy</a></td>
  106.                     </tr>
  107.                     <?
  108.                     $row_count++;
  109.                     }
  110.                     ?>
  111.                     </table>
  112.                 <?
  113.                 } else {
  114.                     
  115.                     echo"<center><font color='#000000' face='Papyrus' size='2'>Confirm Purchase</font></center>";
  116.                     $get_face = mysql_query("SELECT * FROM vipfaceshop_faces WHERE id = ".$_GET['id']."")or die(mysql_error());
  117.                     $face = mysql_fetch_assoc($get_face);
  118.                         $credits = $ppfc - $face['price'];
  119.                         mysql_query("UPDATE users SET pfcredits = '$credits' WHERE user_id = '$pid'")or die(mysql_error());
  120.                         mysql_query("INSERT INTO user_faces(user_id, face_id, vipface) values('$pid', ".$face['id'].", 'Yes')")or die(mysql_error());
  121.                         echo "You have succesfully bought the face<br />";
  122.                         echo "<a href='VIPFaces'>Return</a>";
  123.                     }
  124.                               } else {
  125.                     echo"<meta http-equiv='refresh' content='0;URL=index.php'>";
  126.                 }
  127.             } else {
  128.                 // if he/she isnt, then send them to index.php
  129.                 echo"<meta http-equiv='refresh' content='0;URL=../index.php'>";
  130.             }
  131.             ?>
  132.             </div>
  133.             <div id="content_bottom"></div>
  134.         </div>

  135.         <div id="right">
  136.             <div id="news_top"></div>
  137.             <div id="small_middle" style="width: 231; height: 19">
  138.             <?
  139.             include("includes/news.php");
  140.             ?>
  141.             </div>
  142.             <div id="small_bottom"></div>

  143.             <div id="status_top"></div>
  144.             <div id="small_middle" style="width: 231; height: 22">
  145.             <?
  146.             include("includes/articles.php");
  147.             ?>
  148.             </div>
  149.             <div id="small_bottom"></div>

  150.             <div id="featured_top"></div>
  151.             <div id="small_middle" style="width: 231; height: 25">
  152.             <?
  153.             include("includes/forum.php");
  154.             ?>
  155.             </div>
  156.             <div id="small_bottom"></div>
  157.         </div>
  158.     </div>
  159. <div id="footer"></div>
  160. <? include("Includes/bottom.php"); ?>
  161. </div>
  162. </body>
  163. </html>
Oprettet af:

Kommentar
18:58 15/12/2009
Får du ikke en fejl ved linie 1 ? Tænker på den måde du afslutter dit php
Oprettet af:

Kommentar
19:12 15/12/2009
nej for ingen fejl, har det sådan på alle mine filer og ingen af dem giver fejl.
Oprettet af:

Kommentar
19:14 15/12/2009
okay, normalt startes og lukkes php sån her: <?php ?>

Har ikke lige set din "metode" før med php?>
Oprettet af:

Kommentar
19:17 15/12/2009
når men er det ikke lidt lige meget vis det ikke giver fejl ??
Oprettet af:

Kommentar
19:51 15/12/2009
er der slet ingen der ved hvad jeg gør galt?

og har tænkt lidt over om det måske kan være min mysql tabel?
Oprettet af:

Kommentar
18:55 20/12/2009
Du skal være oprettet og logget ind for at svare på en tråd
Copyright © Rowl.dk v/ Michael Raagaard | 2005-12 | Alle rettigheder forbeholdes