>

저는 PHP와 mysqli에서 처음입니다

업데이트가 작동하지 않고 출력으로 만 제공됩니다 :데이터가 업데이트되지 않음

플레이어 이름은 데이터베이스에 대한 업데이트이며 var가있는 데이터베이스의프라임 키입니다. "spieler"

자세한 부분은 어디에 있습니까?

많은 포럼, 튜토리얼 및 사이트를 읽었지만 좋은 아이디어를 찾을 수 없습니다.

<?php
        if(isset($_POST['update']))
        {
        require 'inc/dbinfinite.php';
        mysqli_select_db($link, "infinite")
        or die ("Verbindung zur Datenbank war nicht m&ouml;glich!");
        $spieler = $_POST['spieler'];
        $imp = $_POST['imp'];
        $plani1 = $_POST['plani1'];
        $plani2 = $_POST['plani2'];
        $plani3 = $_POST['plani3'];
        $plani4 = $_POST['plani4'];
        $plani5 = $_POST['plani5'];
        $spinfo = $_POST['spinfo'];
        $planiname1 = $_POST['planiname1'];
        $planiname2 = $_POST['planiname2'];
        $planiname3 = $_POST['planiname3'];
        $planiname4 = $_POST['planiname4'];
        $planiname5 = $_POST['planiname5'];
        $BtP1 = $_POST['BtP1'];
        $BtP2 = $_POST['BtP2'];
        $BtP3 = $_POST['BtP3'];
        $BtP4 = $_POST['BtP4'];
        $BtP5 = $_POST['BtP5'];
        $p1armee = $_POST['p1armee'];
        $p2armee = $_POST['p2armee'];
        $p3armee = $_POST['p3armee'];
        $p4armee = $_POST['p4armee'];
        $p5armee = $_POST['p5armee'];
       $query = "UPDATE `spielerdaten` SET 
        `imp`='".$imp."',
        `plani1`='".$plani1."',
        `plani2`='".$plani2."',
        `plani3`='".$plani4."',
        `plani5`='".$plani3."',
        `plani4`='".$plani5."',
        `spinfo`='".$spinfo."',
        `planiname1`='".$planiname1."',
        `planiname2`='".$planiname2."',
        `planiname3`='".$planiname3."',
        `planiname4`='".$planiname4."',
        `planiname5`='".$planiname5."',
        `BtP1`='".$BtP1."',
        `BtP2`='".$BtP2."',
        `BtP3`='".$BtP3."',
        `BtP4`='".$BtP4."',
        `BtP5`='".$BtP5."',
        `p1armee`='".$p1armee."',
        `p2armee`='".$p2armee."',
        `p3armee`='".$p3armee."',
        `p4armee`='".$p4armee."',
        `p5armee`='".$p5armee."',
        WHERE `spieler` = $spieler";
           $result = mysqli_query($link, $query);
           if($result)
           {
               echo 'Data Updated';
           }else{
               echo 'Data Not Updated';
           }
           mysqli_close($link);
        }
        ?>

검색 측의 내 HTML 코드 :

<h1>Hier könnt ihr spieler und koords und imps eintragen bei koords bitte XXXX:XX:XX:XX auch die endkoords mit angeben!
    bei imps ggf nur kürzel<h1>
<form action="dbupdate.php"method="post">
<br> Spieler:
<input type="text" name="spieler" size="8" placeholder="Spielername"><br>

<br>Imperium:
<input type="text" name="imp" size="7"placeholder="Imperium"><br>
<br>Planiname 1:<input type="text" name="planiname1" size="10" placeholder="Planiname">Plani Koords:<input type="text" name="plani1" size="10" placeholder="XXXX:XX:XX:XX"> Armeen P1 <input type="text" name="p1armee" size="10"placeholder="Armeen"> BT-P1 <input type="text" name="BtP1" size="10"placeholder="BT"><br>
<br>Planiname 2:
<input type="text" name="planiname2" size="10" placeholder="Planiname">Plani Koords <input type="text" name="plani2" size="10" placeholder="XXXX:XX:XX:XX"> Armeen P2 <input type="text" name="p2armee" size="10"placeholder="Armeen">BT-P2 <input type="text" name="BtP2" size="10"placeholder="BT"><br>
<br>Planiname 3:
<input type="text" name="planiname3" size="10" placeholder="Planiname">Plani Koords<input type="text" name="plani3" size="10"placeholder="XXXX:XX:XX:XX">Armeen P3 <input type="text" name="p3armee" size="10"placeholder="Armeen">BT-P3 <input type="text" name="BtP3" size="10"placeholder="BT"><br>
<br>Planiname 4:
<input type="text" name="planiname4" size="10" placeholder="Planiname">Plani Koords<input type="text" name="plani4" size="10"placeholder="XXXX:XX:XX:XX">Armeen P4 <input type="text" name="p4armee" size="10"placeholder="Armeen">BT-P4 <input type="text" name="BtP4" size="10"placeholder="BT"><br>
<br>Planiname 5:
<input type="text" name="planiname5" size="10" placeholder="Planiname">Plani Koords <input type="text" name="plani5" size="10"placeholder="XXXX:XX:XX:XX">Armeen P5 <input type="text" name="p5armee" size="10"placeholder="Armeen">BT-P5 <input type="text" name="BtP5" size="10"placeholder="BT"><br>
<br>Spieler Info Fleeter, Raider oder Händler:
<input type="text" name="spinfo" size="8"placeholder="Spieler info"><br>

<input type="submit" name="update" value="Nachricht abschicken">
<input type="reset" value="Eingaben löschen">
</form>


  • 답변 # 1

    SQL 문 끝에 콜론이 누락되어 문제가 발생할 수 있습니다.

    대신

    WHERE `spieler` = $spieler";
    
    

    시도

    WHERE `spieler` = '".$spieler."'";
    
    

    댓글을 달기에는 테스트되지 않았으며 평판이 충분하지 않습니다.)

    건배 굽기

  • 답변 # 2

    알겠습니다.

    <?php
    if(isset($_GET['update']))
    {
    require 'inc/dbinfinite.php';
    
    mysqli_select_db($link, "infinite")
    or die ("Verbindung zur Datenbank war nicht m&ouml;glich!");
    $spieler = $_GET['spieler'];
    $imp = $_GET['imp'];
    $plani1 = $_GET['plani1'];
    $plani2 = $_GET['plani2'];
    $plani3 = $_GET['plani3'];
    $plani4 = $_GET['plani4'];
    $plani5 = $_GET['plani5'];
    $spinfo = $_GET['spinfo'];
    $planiname1 = $_GET['planiname1'];
    $planiname2 = $_GET['planiname2'];
    $planiname3 = $_GET['planiname3'];
    $planiname4 = $_GET['planiname4'];
    $planiname5 = $_GET['planiname5'];
    $BtP1 = $_GET['BtP1'];
    $BtP2 = $_GET['BtP2'];
    $BtP3 = $_GET['BtP3'];
    $BtP4 = $_GET['BtP4'];
    $BtP5 = $_GET['BtP5'];
    $p1armee = $_GET['p1armee'];
    $p2armee = $_GET['p2armee'];
    $p3armee = $_GET['p3armee'];
    $p4armee = $_GET['p4armee'];
    $p5armee = $_GET['p5armee'];
    
    
      $select = "UPDATE `spielerdaten` SET 
    `imp`='".$imp."',
    `plani1`='".$plani1."',
    `plani2`='".$plani2."',
    `plani3`='".$plani4."',
    `plani5`='".$plani3."',
    `plani4`='".$plani5."',
    `spinfo`='".$spinfo."',
    `planiname1`='".$planiname1."',
    `planiname2`='".$planiname2."',
    `planiname3`='".$planiname3."',
    `planiname4`='".$planiname4."',
    `planiname5`='".$planiname5."',
    `BtP1`='".$BtP1."',
    `BtP2`='".$BtP2."',
    `BtP3`='".$BtP3."',
    `BtP4`='".$BtP4."',
    `BtP5`='".$BtP5."',
    `p1armee`='".$p1armee."',
    `p2armee`='".$p2armee."',
    `p3armee`='".$p3armee."',
    `p4armee`='".$p4armee."',
    `p5armee`='".$p5armee."'
    WHERE `spieler` = '".$spieler."'";
    
       $result = mysqli_query($link, $select);
    
           echo "<p align=center  >  <a href='http://XXX.de/forum/index.php?XXXX/'>‪Spieler Geändert zurück zur suche?</a></p>";
    
       mysqli_close($link);
    }
    
    
    
    ?>
    
    

    고마워 :)

    폐쇄

관련 자료

  • 이전 javascript - 객체 배열을 변환하는 방법?
  • 다음 amazon web services - missingrequiredparameter - 매개 변수에 필수 키 'functionname'이 누락되었습니다