Send email to DB - Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more
Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more
Go Back   Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more > Webmaster Tech > Programming > PHP Development

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 09-23-2010, 07:09 AM   #1 (permalink)
Junior Member
 
Join Date: Sep 2010
Posts: 1
Default 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

Last edited by helmz; 09-23-2010 at 07:15 AM.
helmz is offline   Reply With Quote
Sponsored Links
Old 09-24-2010, 12:19 AM   #2 (permalink)
Regular User
 
Join Date: Apr 2010
Posts: 444
Default Re: Send email to DB

I would plug that into a validator and see if anything pops up. It looks good to me and I can't really find anything wrong with it. Did you set up the databases right?

Also, if you want more help you can ask over at myhosting.com/forums. You'll get an answer almost instantly from the gurus over there.
__________________
My Site: MacLappy [link coming soon!]

Web hosting provided by: Myhosting.com
standingoten is offline   Reply With Quote
Old 10-04-2010, 09:28 AM   #3 (permalink)
Junior Member
 
Join Date: Aug 2010
Posts: 30
Default Re: Send email to DB

Good idea..
fashionkid is offline   Reply With Quote
Old 10-21-2010, 03:42 PM   #4 (permalink)
Junior Member
 
apice internet's Avatar
 
Join Date: Oct 2010
Location: Brazil
Posts: 21
Default Re: Send email to DB

Are you trying to search the DB without connecting to the database initially.
Let the changing connection at the beginning of the file.
apice internet is offline   Reply With Quote
Old 12-13-2010, 10:23 PM   #5 (permalink)
Junior Member
 
Join Date: May 2009
Posts: 4
Default Re: Send email to DB

most of it you may execute via mysql query without any num row results , on count use count(field) sql syntax.
herovinero is offline   Reply With Quote
Old 12-17-2010, 04:36 AM   #6 (permalink)
Junior Member
 
Join Date: Nov 2010
Posts: 16
Default Re: Send email to DB

hello.

error?
faca5 is offline   Reply With Quote
Old 12-18-2010, 03:20 PM   #7 (permalink)
Junior Member
 
Join Date: Dec 2010
Location: Viimsi, Estonia
Posts: 3
Send a message via MSN to Hypik
Default Re: Send email to DB

Code:
 //if(!$email == "" && (!strstr($email,"@") || !strstr($email,"."))) {
Make this active again (remove "//") and then Remove "(" before !strstr and one ")" from end. What happens?
Hypik is offline   Reply With Quote
Old 12-20-2010, 03:45 AM   #8 (permalink)
Junior Member
 
Join Date: Dec 2010
Posts: 26
Default Re: Send email to DB

Most of it you possibly will implement via mysql reservation exclusive of any num line up results , on calculate use count(field) sql sentence structure.
smith7868 is offline   Reply With Quote
Old 12-28-2010, 02:47 AM   #9 (permalink)
Junior Member
 
Join Date: Dec 2010
Posts: 29
Default Re: Send email to DB

Whether your organization just sends a newsletter, or needs to send a variety of correspondenses to many different subsections of your database, we'll build and install tools that help you do it automatically and easily, without handing your email lists over to an outside organization.

_______________________________________
RVs For Sale
Classic Cars For Sale

Last edited by Maxy28; 12-28-2010 at 02:51 AM.
Maxy28 is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Sponsors

» Links

» Affiliates
Web Hosting
Online Backup Reviews
Marketing Find
Merchant Select
SiteMap Builder
Host Compare

» Links

» Sports Network
Paintball Forum
Football Forum
Hockey Forum
Golf Forum
Boxing Forum
Lacrosse Forum
Baseball Forum
SnowBoarding Forum
Soccer Forum
MMA Forum


All times are GMT -4. The time now is 08:00 PM.


Powered by vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.2
Webmaster Forums
Web Hosting | Chicago Web Hosting | Web Hosting