Page php, Not Saved In Bank ! Why?

Asked

Viewed 459 times

0

The code below is inside a huge page, I need that the value that the person put in "email" is inserted in the variable and so to the bank. I’ve reviewed thousands of different codes but always continues with the same problem Does not record in the bank, the connection is established (no error shadow). I’ve reviewed the code several times, but I can’t solve the problem.

<div id="boxes">

<!-- Janela Modal com caixa de diálogo -->  
<div id="dialog1" class="window">
  <div class="d-header">

    <form method="POST" action="?go=cadastrar">
    <img src="imagem.png">
        <h3>Digite seu E-mail e comece GRÁTIS !!</h3>
        <label>Consiga agora o incrível programa que irá lhe ajudar!</label>
        <input type="text" name="email" id="email" required value="E-mail" 
placeholder="E-mail" onclick="this.value=''" maxlength="60" /></a><br/>
        <input type="hidden" name="acao" value="Enviado">
        <input type="submit" name="cadastro" id="cadastro" value="Cadastrar" 
onclick="javascript:window.open('download.php?file=apostila_JAVA.pdf')"/>
<br/>

        <a href="http://echef.teccitystore.com.br/downloads.html" 
 name="fechar">Fechar[x]</a>
   <img src="logo.png">
 </form>
  </div>
  <div class="d-blank"></div>
</div>
<!-- Fim Janela Modal com caixa de diálogo -->  
</div>

<!-- Máscara para cobrir a tela -->
  <div id="mask"></div>


 <?php
 if(isset($_GET['go'])){
  if($_GET['go'] == 'cadastrar'){
    $email = $_POST['email'];

    if(empty($email)){
        echo"
            <script>
            alert('Campo está vazio');
            history.back();
            </script
        ";
    }else{
        $query1 = @msql_fetch_row(@msql_query("SELECT * FROM email WHERE = 
'$email'"));
        if($query1 == 1){
            echo "<script>
            alert('Email já existente !!');
            history.back();
           </script";
        }else{
            @mysql_query("INSERT INTO downloads (email) VALUES ('email')");
            echo "<script>
            alert('Cadastro Efetuado !!');
            history.back();
            </script";
            header("location: index.php");
            }
        }
     }
}
  ?>
  • First thing you should do is remove "@" from Mysql connections. Then run again and see if an error has occurred via mysql_error.

  • he.. shows no errors.. just doesn’t appear in the database.. it’s like the data just vanished out of nowhere

2 answers

0

Looking at your code in Query1 there is an error in the sql string in the WHERE condition:

$query1 = @msql_fetch_row(@msql_query("SELECT * FROM email WHERE = 
'$email'"));

Change it to:

$query1 = @mysql_fetch_row(@msql_query("SELECT * FROM email WHERE email = 
'$email'"));

and also change the:

@mysql_query("INSERT INTO downloads (email) VALUES ('email')");

for:

@mysql_query("INSERT INTO downloads (email) VALUES ( $email)");

Taking a quick look was what I thought might be giving error. I hope I helped!

  • I did as you advised... but he doesn’t put it in the seat.. It’s coming back normally.. It’s like he inserted it.. If you’re missing anything, please let me know and I’ll try to show you as much detail as I can..

  • Remove @ from the front of function calls, if you have an error it will appear on the screen. These@ suppress any error that is happening by making it difficult to debug the code.

  • I took it... I swear.. and it shows no error

  • Try using the mysql_error() function and see if you have any output.

  • 1

    It appears this -> Parsing error: syntax error, unexpected end of file in C: wamp64 www page downloads.php on line 954... already reviewed and has no tag alone..

  • Right now I can’t test where I am, but if you submit your full code later when I get home I can test the full code. Send your code to Pastebin and post the link here if you feel better.

Show 1 more comment

0


Check the SQL commands:

$sql = "SELECT 1 FROM email WHERE = '" . $email . "' ";

$insert = "INSERT INTO downloads (email) VALUES ('" . email . "')";

Also check the closing of the SCRIPT tag.

If if Empty doesn’t work, try (email != '') which can help you more with the logic itself.

  • I executed everything I said. but he says --> Parse error: syntax error, unexpected end of C file: wamp64 www page downloads.php on 951 line

  • and what’s on line 951?

  • The end... </html>

  • includes one more } before ? > and sees if it rotates.

  • Conseguiii.. hyoooo.. kk .. Thanks.. But still, It is not entering in the database.. it shows by Javascript that the registration has been made.. but not in the bank

  • You should have a log folder in "C: wamp64" with the errors they give in the application. In these logs you find the absolute error that occurs in the execution. Although on the client side you see that you had error, it may have occurred something on the server side.

  • Understood.. Thank you.. I’ll try there.. I really appreciate your help.. and I’m sorry if I did something wrong. I’m new at this ... Thank you.

Show 2 more comments

Browser other questions tagged

You are not signed in. Login or sign up in order to post.