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 6120813
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:42:41+00:00 2026-05-23T15:42:41+00:00

I created a function to get the a value of last field in a

  • 0

I created a function to get the a value of last field in a table like this

private function _getLastPosition ($menuId) {
    $select = $this -> getDbTable() -> select();
    $select -> where("menu_id = ?", $menuId)
            -> order('position DESC');
    $row = $this -> getDbTable() -> fetchRow($select);
    if($row) {
        return $row -> position;
    } else {
        return 0;
    }
}

When I run it, I get

Message: SQLSTATE[HY093]: Invalid parameter number: no parameters were bound

Please help me fix this

  • 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-05-23T15:42:41+00:00Added an answer on May 23, 2026 at 3:42 pm

    It typically means that $menuId was empty/NULL. Ensure that $menuId variable has a proper value before using it in $select.:

    You could add the following line at the beginning of your function, before you use $menuId in your $select->where() call:

    if(empty($menuId))
       return 0; 
    

    This will return 0 in case no $menuId was provided. If you want to throw an error (Exception) in such case, you could do the following:

    if(empty($menuId))
       throw new Exception("No Menu ID Provided"); 
    

    Your complete function would look like this:

    private function _getLastPosition ($menuId) {
        if(empty($menuId))
           throw new Exception("No Menu ID Provided");
        $select = $this -> getDbTable() -> select();
        $select -> where("menu_id = ?", $menuId)
                -> order('position DESC');
        $row = $this -> getDbTable() -> fetchRow($select);
        if($row) {
            return $row -> position;
        } else {
            return 0;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to get a reference back to the function that created an
This question comes after solving my last question , I'd like to get some
QUESTION How can I create a MySQL table so, that a field's default value
Django's get_or_create function always cause get() returned more than one Model name error in
function check_timer(){ //get product ids var product_ids= document.getElementsByClassName(product_id); //create for loop for(var i=0; i<product_ids.length;
I have a function that creates a course. I am trying to get the
i want to create functions what get the folder size. I write small function:
i have this situation: <a href=# onClick=submitNotification(1);>click1</a> <a href=# onClick=submitNotification(2);>click2</a> <a href=# onClick=submitNotification(3);>click3</a> function
On a Wordpress site I'm developing, I have created a fcustom user meta field
I being for the last 12 hours trying to understand why this is happening.

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.