こんにちは、Vote のような srcipt を実行しようとしています
したがって、行bitwa_glosyは0に設定されます
ボタンを押すと、ポストメソッドの値が0から1に増加し、ボタンを押すたびに成長するはずです。
DB からの値の読み取り
$Query="SELECT * FROM tentego_img WHERE id='$aid'";
$QueryResult=mysql_query($Query);
while($Kol_a=mysql_fetch_array($QueryResult)){
$a_glos =$Kol_a['bitwa_glosy']; // Values= 0
これで、bitwa_glosy の値が 0 であることがわかりました
そして増やそうとする
if(isset($_POST['glos_a']))
{
$plus = 1;
$a_glos = $a_glos+$plus;
$dodaj_glos_a = "UPDATE `tentego_img` SET `bitwa_glosy` = $plus WHERE `id`=$aid";
$idzapytania = mysql_query($dodaj_glos_a);
}
しかし、それは機能しません。理由はわかりません
投稿フォームがあります
<form method="post"><input type="submit" name="glos_a" value="Głosuj +"/></form>
***あなたの提案と回答から編集された最終コードそれでも機能しません、私はそれらをあきらめます私を助けようとしているみんなに感謝します
乾杯
注意してくれてありがとう、私はそれらをあきらめ、コードが機能する場合と機能しない場合があり、回答からすべてを試しました。
あなたの提案でいくつか変更されたコードがありますが、それでも機能しません
乾杯!!
<!-- Begin Block -->
<?php
$ilosc= 1;
$typ= 'img';
#Lewa
$Query="SELECT * FROM tentego_img WHERE type='img' ORDER BY RAND() LIMIT ".$ilosc;
$QueryResult=mysql_query($Query);
while($Kol=mysql_fetch_array($QueryResult)){
$atytul =$Kol['title'];
$asrc =$Kol['src'];
$aid =$Kol['id'];
}
#Prawa
$QueryResult=mysql_query($Query);
while($Kol1=mysql_fetch_array($QueryResult)){
$btytul =$Kol1['title'];
$bsrc =$Kol1['src'];
$bid =$Kol1['id'];
}
echo '<table border="0"><tr>';
echo '<td><span style="color:green">#1#</span> '.$atytul.'</td><td></td><td><span style="color:red">#2#</span> '.$btytul.'</td><tr>';
echo '<td><a href="/img/'.$aid.'/'.$atytul.'/"><img src="/upload/'.$asrc.'" alt="'.$atytul.'" title="'.$atytul.'" width="370px" height="370px" /></a>Liczba głósów:0<form method="post"><input type="submit" name="glos_a" value="Głosuj +"/></form></td><td><img src="./_themes/fajna/bitwa/vs.png" /></td>';
echo '<td><a href="/img/'.$bid.'/'.$btytul.'/"><img src="/upload/'.$bsrc.'" alt="'.$btytul.'" title="'.$btytul.'" width="370px" height="370px" /></a>Liczba głosów:0<form method="post"><input type="submit" name="glos_b" value="Głosuj +"/></form></td>';
echo '</tr></table>';
$plus = 1;
if(isset($_POST['glos_a']))
{
$a_glos = $a_glos+$plus;
$dodaj_glos_a = "UPDATE `tentego_img` SET `bitwa_glosy` = `bitwa_glosy` + $plus WHERE `id`=$aid";
$idzapytania = mysql_query($dodaj_glos_a);
}
if(isset($_POST['glos_b']))
{
$dodaj_glos_b = "UPDATE `tentego_img` SET `bitwa_glosy` = `bitwa_glosy` + $plus WHERE `id`=$bid";
$idzapytania2 = mysql_query($dodaj_glos_b);
}
?>
</div>
<!-- End Block -->