Re: script to check subscription – PHP

  php

Q(Question):

chadlupkes wrote:

I’m creating a series of forms for people to contact their elected
officials at various levels of government. I’m trying to create a way
to confirm that the person using the form is one of our members, and
I’m having trouble with the function that is supposed to pull the
registered email addresses and check the email entered against that
list to make sure that someone is registered.

I’m not sure what script you’ll need to see, but here’s the test
function:

I personally would not check a database by email to see if a user exists
but here you go …

function testEmail($emailtocheck) {

$sql = "SELECT id FROM Table WHERE email = ‘".$emailtocheck."’ ";

// change to your favourite db method
if(db::query($sql)){

return true;

}
return false;
}

A(Answer):

LEAVE A COMMENT