Assuming a function argument/parameter is an array? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Assuming a function argument/parameter is an array? (/showthread.php?tid=43826) |
Assuming a function argument/parameter is an array? - El Forum - 07-25-2011 [eluser]zxcv[/eluser] Hello people! This is more a PHP problem more than it is a CI one...but I assume people are familiar with PHP enough to help me with this What I have is an database...with members, where each one have their own unique e-mail. My site has adminspace, which allows a person with admin authority to add new users, remove users and so on. The problem is when a admin is adding a new user. Normally, if someone registers the form validation would check the database if the typed in email already exists, it would also require the E-mail field to be set. The thing with the admin is that he/she can choose NOT to add emailinformation when adding a new member, allowing the member itself to set it manually as he/she signs in for the first time. Here's the problem...IF the admin choose to type in an email, the process of doing so will always return true, even though the email already is registered. That is because the function I use for this action is weird and behaves badly. Here's the code: Code: public function validate_email($email) This is a function used in my model, maybe that's the problem? However, here is the error message: Quote:A PHP Error was encountered I marked Line 74 with a comment in the code...how do I solve this? Thank you zxcv Assuming a function argument/parameter is an array? - El Forum - 07-25-2011 [eluser]zxcv[/eluser] Never mind, it worked now! I think the problem was that I used the variable email in the function, when the main modelfunction has it parameter called "$email", also I had a variable email as I retrieved all the emails from the database. :red: |