need to pass email field value into variable - 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: need to pass email field value into variable (/showthread.php?tid=36168) |
need to pass email field value into variable - El Forum - 11-23-2010 [eluser]Brad K Morse[/eluser] model function: gets email of $venue_id = id Code: function getVenueChairEmail($venue_id) { Then I want to pass the email into the variable $to, like I am trying to do below Code: $to = $this->data_model->getVenueChairEmail($venue_id); It is not passing anything into $to, tested by printing it out, empty. I imagine its not as easy as that, any help is appreciated. need to pass email field value into variable - El Forum - 11-23-2010 [eluser]skunkbad[/eluser] Have you tested the raw query on the database to see if it returns anything? According to your code, it looks like your query is: SELECT email from venues WHERE id = $venue_id; If you plug in a venue id and it doesn't work, then there's your problem. If it does work, then you should look at the value of $venue_id before you try to pass it to the model. need to pass email field value into variable - El Forum - 11-23-2010 [eluser]Greg Aker[/eluser] You need to return from the model function. try: model: Code: public function get_venue_chair_email($venue_id) Controller: Code: $to = $this->data_model->get_venue_chair_email($venue_id) -greg need to pass email field value into variable - El Forum - 11-23-2010 [eluser]Brad K Morse[/eluser] Thank you Greg! That did the trick, you're 2 for 2! need to pass email field value into variable - El Forum - 11-23-2010 [eluser]Greg Aker[/eluser] If you don't have it. get xdebug running on your dev environment. using var_dump with that installed, and you'll see all sorts of pretty things about your data. |