Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8372617
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T14:28:43+00:00 2026-06-09T14:28:43+00:00

class Application_Model_DbTable_Email extends Zend_Db_Table_Abstract { protected $_name = ‘memberdetail’; function getUserid($email) { $subquery =

  • 0
class Application_Model_DbTable_Email extends Zend_Db_Table_Abstract
{

protected $_name = 'memberdetail';

    function getUserid($email)
    {   
        $subquery = $this->select()
        ->from('memberdetail', array('memberid'))
        ->where('email = ?', $email);

        $select = $this->select()
        ->from('usertable', array('userid'))
        ->join('memberdetail', 'usertable.userid = memberdetail.memberid')
        ->where('usertable.userid = ?', $subquery);

        $row = $select->query()->fetch();

        if (!$row) {
        echo "User id not found";
        } else {
        return $userid = $row['userid'];
        }


    }

}

Hi, I am trying to return the userid from the above queries. However, the queries does not seemed to be executed as I always get refreshed whenever I call this function.

P.S this set of queries were given to me by another member.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T14:28:44+00:00Added an answer on June 9, 2026 at 2:28 pm

    it looks like this is being over thought. According to the info provided usertable.userid = memberdetail.memberid with this being the case your function is simple.

    /** this function assumes one and only one email will match a memberid
     *  this function can be improved by validating $email as existing in DB
     *  prior to querying DB, should be done at form level but could be accomplished here
     *  with Zend_Validate_Db_RecordExists()
     */
    public function getUserIdFromEmail($email) {
    $select = $this->select();
    $select->where('email = ?',$email);
    
    $row = $this->fetchRow($select);//fetch a single row
    if (!is_null($row) {//fetchRow returns null if no row matched
        return $row->memeberid;//return memberid as string/integer = usertable.userid
        } else {
          //handle error
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following zendframework model classes class Application_Model_DbTable_Mobile extends Zend_Db_Table_Abstract { protected $_name
I have these two models: class Application_Model_List extends Zend_Db_Table_Abstract { protected $_name = 'list';
I have this table structure <table id=latest class=debt> <thead> <tr> <th width=50>Credor</th> <th width=50>Devedor</th>
So I have a few Django models that look like this: class City(models.Model): name
Here is a snippet of models.py class Applicant(models.Model): name = models.CharField(...) email = models.CharField(...)
Read the comments in the code for a description: <?php class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
I've found out that when I extends Zend_Db_Table_Abstract in my model I get An
in my zf application i have base model class Application_Model, which connects to db
Here's a snippet from my application: class PortolioItem(models.Model): ... user = models.ForeignKey(User) contract =
I have following models setup in my Django application class School(models.Model): name = models.TextField()

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.