I really do hope that this is not too much of a newbie question.
I have a MySQL database set up. Within it, I have created a table with the following fields:
[id][email][name][jobtitle][company][phone][country]
I want to create a short form that looksup the email address, checks if it's in the database, if it is, (and based on radio button a b or c selection) then it will send the user to page a, b or c respectively. If it is not, then it would send the user to page a2, b2 or c2 respectively.
(Now, creating the form I can do!)
My problem is how to write the query.
I have read the faq for newbies (and performed numerous google searches).
I can work out how to connect to the database.
I can see that I need some kind of select statement like this (but I know the end bit is wrong as email needs to equal form input value and I'm not sure how to say that):-
Code: Select all
$result= $xxx->db->query('SELECT email FROM tablename WHERE email= '?');I found this in a faq section:
Code: Select all
$a = “b”;
if($a == “a”){
//do something
}elseif($a == “c”){
//do something
}else{
echo “$a isn’t a or c”;
}Can anykind person give me some guidance on this please?
Thanks
Anni