Announcement Announcement Module
Collapse

myhosting.com Forum Guidelines

Welcome to the myhosting.com Forums! The purpose of this forum is to allow you to discuss topics relating to hosting and topics of interest with other myhosting.com Customers. The primary focus should relate to issues not generally included in our Wiki or Control Panel, or information not provided by our Customer Support Team. Some examples include programming and coding support, web site design ideas and SEO practices.

The forum is not meant as a replacement to our Wiki or Customer Support. We highly recommend searching our Wiki before posting on the forum. Also, if you have a question for our Customer Support team, please contact them as you would normally.

We ask that if you have any complaints or questions relating specifically to your account, that you address them to our Customer Support department. Do not post personal account information such as passwords or other sensitive and private information the forum, as this type of information is best kept secret. Also, please be respectful of other users and refrain from defamatory comments or use of coarse language.

We will visit the forum from time to time, and contribute to various topics. We reserve the right to delete any posts which are deemed offensive or against the spirit of the forum. Any spamming or illegal activity will not be tolerated. We also reserve the right to block any user who violates these guidelines.

To get started, we welcome you to sign up at our User Management site. Any account created there will have access to these forums, our Wiki, our Ideas site and commenting permission on our Status Blog.
See more
See less
Send email to DB Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Send email to DB

    Im having some problems trying to send mail to db, and the if arent correct... but im new and i dont have too much idea need some help please, first there are legal conditions to accept, then a email filter, and then must know if mail is in database already.

    This is the code:

    PHP Code:
    <?php

    $email 
    $_POST["email"];

    // $search = "SELECT * FROM `[db]` WHERE `email` = '$email'";
    // $result = mysql_query($search) or die ('Error');
    // $num = mysql_num_rows($result);

    if (isset($_POST['privacidad']))
    {   
    $privacidad '1';
        echo
    "Terms accepted.";}

        if (
    $seleccionado == '1') {

            
    // Comprobar si el usuario introducido existe
                      
    $error.=  "Check again:<br /><br />";
                      
    $checkuser mysql_query("SELECT email FROM email WHERE email='$email'");
                      
    $username_exist mysql_num_rows($checkuser);

                      if(
    $username_exist 0){

                      
    $error.= "- Already exists<br />";

                      }

            
    //if(!$email == "" && (!strstr($email,"@") || !strstr($email,"."))) {

            //Check mail
                    
    if(eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$"$email)) {  echo "";

                    } else {

                    echo 
    "- Incorrect email. ";}
                    }

                    
    //$estat = "<h2>Not sent</h2>";
                    //echo $estat;
                    //die ("Go back!");

            
    } else {

                   
    // if ($num != 0) {
                   // echo ("Email used"); }
                   // else {

                    
    mysql_connect('host' 'user''pw');
                    
    mysql_select_db("dbname");
                    
    mysql_query("INSERT INTO email (email) VALUES ('$email')");

                        echo 
    mysql_error();
                        echo 
    'email sent 222';
                        echo 
    $email;
                    }

     
        } else {
            echo 
    'must accept legal terms';
            
    alert ('must accept legal terms');

        }
    There are some comments that are previosly tryies, sorry about. Must say CONNECTING WITH DB IS NOT THE PROBLEM(I tryed it before putting some ifs), the problem is syntax i think... thanks
Working...
X