Avatar of Andrius Mo
Andrius Mo

asked on 

My code php code does not update Mysql, need help to get id_user

I think i do not  establish $cmember['id_user'] after the post submit is made? I belive i don't seem to be sending the payer id after form post is made. how could i establish user id, or any other way around?
Pressing accept or reject, refreshes the page, but does not update 'users' table
<?php
include ("top_tpl.php");
$clan = mysql_fetch_array(count_query("SELECT * FROM `clans` WHERE `id` = '".$row['clan']."'"));
$zap_cmember = count_query("SELECT * FROM `users` WHERE `clan` = '".$clan['id']."' AND `clan_stat` = 'Pending'");

?>

            <?php


                    if (isset($_POST['Yes']))
                    {
                        count_query("UPDATE `users` SET `clan_stat`='Member', read_msg='0' WHERE `id_user`='".$cmember['id_user']."'");
                        $time = date('j.n.y H:i');
                        count_query("INSERT INTO `message` (`time`, `to`, `text`, `metka`) VALUES ('".$time."', '".$cmember['name']."', 'You were accepted into the clan <a href=clan.php>".$clan['name']."</a>', '6')");
                        echo "<script>location.href='clan_plac.php'</script>";
                    }
                    else if (isset($_POST['No']))
                    {
                        count_query("UPDATE `users` SET `clan`='0', read_msg='0' WHERE `id_user`='".$cmember['id_user']."'");
                        $time = date('j.n.y H:i');
                        count_query("INSERT INTO `message` (`time`, `to`, `text`, `metka`) VALUES ('".$time."', '".$cmember['name']."', 'Your application to join clan <a href=clan.php?id=".$clan['id'].">".$clan['name']."</a> rejected', '6')");
                        echo "<script>location.href='clan_plac.php'</script>";
                    }
                $ind = 0;
                while ($cmember = mysql_fetch_array($zap_cmember))
                {
                    echo "<form method='post'><tr><td><a href='player.php?id=".$cmember['id_user']."' target='_blank'>".$cmember['name']."</a></td><td><input type='submit' name='Yes' value='Accept'><input type='submit' name='No' value='Reject'></td></tr></form>";
                    $ind++;
                }
                if ($ind == 0)
                {
                    echo "No applications";
                }
                ?>

<?php include ("footer_tpl.php");?>

Open in new window

PHPMySQL Server

Avatar of undefined
Last Comment
Andrius Mo

8/22/2022 - Mon