PDA

View Full Version : Resolved mistake in mysql script



auriaks
11-10-2009, 11:34 PM
hi, i have mistake made in this script: the problem is, that when i push POST(type='padekoti') i got answer already exists. But my variables and table "balsai" is totaly emplty...


<?php
include('../db_conn.php');
$id = $_GET['id'];
if(isset($_POST['padekoti'])) {
$queryget = mysql_query("SELECT * FROM forumas WHERE id = '$id' ORDER BY `date`") or die("Error with query55");
while ($row = mysql_fetch_array($queryget))
{
$hx = $row['thx'];
$nick = $row['nick'];
$nack = $_SESSION['nick'];
$queryget1 = mysql_query("SELECT * FROM balsai WHERE id = '$id' AND nick ='$nack'");
if ($queryget1) { echo "already exists"; } else {

$nack = $_SESSION['nick'];
$thx = $hx + 1;
$times = '1';
mysql_query("UPDATE forumas SET thx = '$thx' WHERE id = '$id'");
mysql_query("INSERT INTO balsai (id, nick, times)
VALUES('$id', '$nack', '$times')") or die(mysql_error());
}}}
?>

If you need some more info, ask which...THANKS :)