Hi,

i'm trying to tell my sql no to delete if the results are 1 and that it has to be at least one user. but i can't:

            <!------------------------------------------>
                <script language="JavaScript">
                    function confirmBox(id) 
                    {
                        if (confirm("Tem a certeza que pretende eliminar este registo?")) 
                        {
                            location.href="remover_user.php?id="+id;
                        }
                        else 
                        {
                            return false;
                        }
                    }
                </script>
            <!---------------------------------------------->

            <!---------------------------------------------->
                <script>
                    function wow()
                    {
                        alert("Tem de existir pelo menos um Administrador.");
                    }
                </script>
            <!---------------------------------------------->

<td width="5%">
                            <a href="edit_user.php?id=<?php echo $list_user['id_utilizador']; ?>">Editar</a>
                        </td>
                            <?php
                                if ($row_users!==1)
                                {
                            ?>
                                <td width="5%">
                                    <a href="#" onclick="confirmBox('<?php echo $row_users['id_utilizador']; ?>')">Remover</a>
                                </td>
                            <?php
                                ;}
                                else
                                {
                            ?>
                                <td width="5%">
                                    <a href="#" onclick="wow()">Remover</a>
                                </td>
                            <?php
                                ;}
                            ?>

Can someone help me?

Thank you

Recommended Answers

All 4 Replies

Yes, and it does the same thing it let me remove if i have 1 result...

Maybe want you are looking for is

$row_users == 1 

Note that == means "equals to", != means "not equals to", while = means "get" in visually all the programming language.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.