fullyloaded Posted March 21, 2007 Share Posted March 21, 2007 hi any one know how i can add code 1 to code 2 witch is below?what im trying to do is have a banned email code so when some one signs up it will say the email has been banned i have a table in my database with the list of emails that i want banned its called banned_emails and iin the banned emails table its called banned_email that is where the emails are please help code 1 : $this->dbu->query("select banned_email from banned_emails where email='".$ld['email']."'"); code 2 : if(!$ld['email']) { $ld['error'].="Please fill in the 'Email Address' field."."<br>"; $is_ok=false; } elseif(!secure_email($ld['email'])) { $ld['error'].="Please provide a valid email address."."<br>"; $is_ok=false; } elseif(!$allowed_email[$ld['email']]) { $this->dbu->query("select members_id from members where email='".$ld['email']."'"); if($this->dbu->move_next()) { $ld['error'].="This email address is already registered."."<br>"; $is_ok=false; } } Quote Link to comment Share on other sites More sharing options...
mmarif4u Posted March 21, 2007 Share Posted March 21, 2007 try to put it before ur if statement Quote Link to comment Share on other sites More sharing options...
fullyloaded Posted March 21, 2007 Author Share Posted March 21, 2007 hi thanks for the reply it didn't work how do you do a simple select from code? Quote Link to comment Share on other sites More sharing options...
mmarif4u Posted March 21, 2007 Share Posted March 21, 2007 $query = "SELECT * FROM table where condition"; $result = mysql_query($query) or die(mysql_error()); $ic=$row->$email; Quote Link to comment Share on other sites More sharing options...
btherl Posted March 21, 2007 Share Posted March 21, 2007 Is this what you want? if(!$ld['email']) { $ld['error'].="Please fill in the 'Email Address' field."."<br>"; $is_ok=false; } elseif(!secure_email($ld['email'])) { $ld['error'].="Please provide a valid email address."."<br>"; $is_ok=false; } elseif(!$allowed_email[$ld['email']]) { $this->dbu->query("select members_id from members where email='".$ld['email']."'"); if($this->dbu->move_next()) { $ld['error'].="This email address is already registered."."<br>"; $is_ok=false; } $this->dbu->query("select banned_email from banned_emails where email='".$ld['email']."'"); if($this->dbu->move_next()) { $ld['error'].="This email address is banned. Please contact the administrator."."<br>"; $is_ok=false; } } Quote Link to comment Share on other sites More sharing options...
fullyloaded Posted March 21, 2007 Author Share Posted March 21, 2007 hi yeah like that but im getting this error any idea why? Process Halted! Error:db::query() failed.ERROR MESSAGE IS: Failed to run Query:select banned_email from banned_emails where email='email@email.com' Unknown column 'email' in 'where clause' Quote Link to comment Share on other sites More sharing options...
mmarif4u Posted March 21, 2007 Share Posted March 21, 2007 hi yeah like that but im getting this error any idea why? Process Halted! Error:db::query() failed.ERROR MESSAGE IS: Failed to run Query:select banned_email from banned_emails where email='email@email.com' Unknown column 'email' in 'where clause' Unknown column 'email' in 'where clause' This means that ur database field name is not matching with ur query column. email will be something other in ur database check it and redo it in ur query. Quote Link to comment Share on other sites More sharing options...
fullyloaded Posted March 21, 2007 Author Share Posted March 21, 2007 hi this is what the table looks like in my database is there any way to make this code work with the table? code : $this->dbu->query("select banned_email from banned_emails where email='".$ld['email']."'"); if($this->dbu->move_next()) { $ld['error'].="This email address is banned. Please contact the administrator."."<br>"; $is_ok=false; } } database table : -- -- Table structure for table `banned_emails` -- CREATE TABLE `banned_emails` ( `banned_emails` text NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- -- Dumping data for table `banned_email` -- INSERT INTO `banned_email` VALUES ('email@email.com'); Quote Link to comment Share on other sites More sharing options...
mmarif4u Posted March 21, 2007 Share Posted March 21, 2007 hi this is what the table looks like in my database is there any way to make this code work with the table? code : $this->dbu->query("select banned_email from banned_emails where email='".$ld['email']."'"); if($this->dbu->move_next()) { $ld['error'].="This email address is banned. Please contact the administrator."."<br>"; $is_ok=false; } } database table : -- -- Table structure for table `banned_emails` -- CREATE TABLE `banned_emails` ( `banned_emails` text NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- -- Dumping data for table `banned_email` -- INSERT INTO `banned_email` VALUES ('email@email.com'); $this->dbu->query("select banned_email from banned_emails where banned_emails='".$ld['email']."'"); if($this->dbu->move_next()) { $ld['error'].="This email address is banned. Please contact the administrator."."<br>"; $is_ok=false; } } Try this. Quote Link to comment Share on other sites More sharing options...
fullyloaded Posted March 21, 2007 Author Share Posted March 21, 2007 thank you guys for your help it now works great!!! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.