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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T20:40:51+00:00 2026-05-30T20:40:51+00:00

I have a simple MySQL 5 database that consists of id – Int –

  • 0

I have a simple MySQL 5 database that consists of

  • id – Int – Primary Key
  • userID – int
  • projectId – int
  • note – varchar (120)

And a simple Flex 4.5 app that I need to search the userID table for all rows belonging to a certain userID and return it to the Flex app. I’m using the default ZendAMF for my remoting. Currently my class looks like:

public function getAllBookmarksByUser($userId) {

        $stmt = mysqli_prepare($this->connection, "SELECT * FROM $this->tablename WHERE userId=?");     
        $this->throwExceptionOnError();

        mysqli_stmt_bind_param($stmt, 'i', $itemID);        
        $this->throwExceptionOnError();

        mysqli_stmt_execute($stmt);
        $this->throwExceptionOnError();

        $rows = array();

        mysqli_stmt_bind_result($stmt, $row->id, $row->userId, $row->projectID, $row->note);

        while (mysqli_stmt_fetch($stmt)) {
          $rows[] = $row;
          $row = new stdClass();
          mysqli_stmt_bind_result($stmt, $row->id, $row->userId, $row->projectID, $row->note);
        }

        mysqli_stmt_free_result($stmt);
        mysqli_close($this->connection);

        return $rows;
    }

But, it’s not working. Not returning any objects when I test it in Flash Builder 4.5 even though I know the entries are in the db.

What am I doing wrong?

Edit
P.S. – This is an Adobe Air mobile app…

Edit

I’m adding a PHP class within the same file that is working perfectly as well. Here is the full file:

<?php

/**
 * Get 
 */
class BookmarksService {

    var $username = "*SQLUserName";
    var $password = "*SQLUserPassword*";
    var $server = "*MySQLServerURL*";
    var $port = "3306";
    var $databasename = "mscoast";
    var $tablename = "bookmarks";

    var $connection;

    /**
     * Connect
     */
    public function __construct() {
        $this->connection = mysqli_connect(
                                $this->server,  
                                $this->username,  
                                $this->password, 
                                $this->databasename,
                                $this->port
                            );

        $this->throwExceptionOnError($this->connection);
    }

    /**
     *Get All
     */
    public function getAllBookmarks() {

        $stmt = mysqli_prepare($this->connection, "SELECT * FROM $this->tablename");        
        $this->throwExceptionOnError();

        mysqli_stmt_execute($stmt);
        $this->throwExceptionOnError();

        $rows = array();

        mysqli_stmt_bind_result($stmt, $row->id, $row->userId, $row->projectID, $row->note);

        while (mysqli_stmt_fetch($stmt)) {
          $rows[] = $row;
          $row = new stdClass();
          mysqli_stmt_bind_result($stmt, $row->id, $row->userId, $row->projectID, $row->note);
        }

        mysqli_stmt_free_result($stmt);
        mysqli_close($this->connection);

        return $rows;
    }


    /**
     * Get All By User ID
     */

public function getAllBookmarksByUser($userId) {

        $stmt = mysqli_prepare($this->connection, "SELECT * FROM $this->tablename WHERE userId=?");      
        $this->throwExceptionOnError();

        mysqli_stmt_bind_param($stmt, 'i', $itemID);      
        $this->throwExceptionOnError();

        mysqli_stmt_execute($stmt);
        $this->throwExceptionOnError();

        $rows = array();

        mysqli_stmt_bind_result($stmt, $row->id, $row->userId, $row->projectID, $row->note);

        while (mysqli_stmt_fetch($stmt)) {
          $rows[] = $row;
          $row = new stdClass();
          mysqli_stmt_bind_result($stmt, $row->id, $row->userId, $row->projectID, $row->note);
        }

        mysqli_stmt_free_result($stmt);
        mysqli_close($this->connection);

        return $rows;
    }


    /**
     * Utility function to throw an exception if an error occurs 
     * while running a mysql command.
     */
    private function throwExceptionOnError($link = null) {
        if($link == null) {
            $link = $this->connection;
        }
        if(mysqli_error($link)) {
            $msg = mysqli_errno($link) . ": " . mysqli_error($link);
            throw new Exception('MySQL Error - '. $msg);
        }       
    }
}

?>

The first function works perfectly. Returns all of the rows. The second, gives no rows…

Also, here are my requests and responses from Flash Builder 4.5 (may or may not be of some use):

Request:

POST /app-resources/gateway.php HTTP/1.1
Referer: app:/Desktop.swf
Accept: text/xml, application/xml, application/xhtml+xml, text/html;q=0.9, text/plain;q=0.8, text/css, image/png, image/jpeg, image/gif;q=0.8, application/x-shockwave-flash, video/mp4;q=0.9, flv-application/octet-stream;q=0.8, video/x-flv;q=0.7, audio/mp4, application/futuresplash, */*;q=0.5
x-flash-version: 10,2,153,1
Content-Type: application/x-amf
Accept-Encoding: gzip,deflate
User-Agent: Mozilla/5.0 (Windows; U; en) AppleWebKit/531.9 (KHTML, like Gecko) AdobeAIR/2.6
Host: www.hidden.hmmmm
Content-Length: 268

Flex Message (flex.messaging.messages.RemotingMessage)     operation = getAllBookmarksByUser    clientId = null    destination = BookmarksService    messageId = A43315C8-6A13-4BAB-9F70-C78337A6AA5A    timestamp = 0    timeToLive = 0    body =     [      0    ]    hdr(DSId) = nil

Response:

HTTP/1.1 200 OK
Date: Mon, 21 Nov 2011 19:03:45 GMT
Server: Apache/2.2.17 (Ubuntu)
X-Powered-By: PHP/5.3.5-1ubuntu7.3
Cache-Control: no-cache, must-revalidate
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Pragma: no-cache
Content-Length: 289
Content-Type: application/x-amf

Flex Message (flex.messaging.messages.AcknowledgeMessage)     clientId = 2FE53654-02C4-3548-136C-000066519473    correlationId = A43315C8-6A13-4BAB-9F70-C78337A6AA5A    destination = null    messageId = 5FCFFE5B-EBA5-2AE9-2A51-00005691367F    timestamp = 132190222500    timeToLive = 0    body = []
  • 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-30T20:40:52+00:00Added an answer on May 30, 2026 at 8:40 pm

    Sorry if this has been solved, but is this because you are providing ($userID) to the function but binding a different variable? ($itemID)

    getAllBookmarksByUser($userId)

    mysqli_stmt_bind_param($stmt, ‘i’, $itemID)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table in a MySQL database that I am running simple SELECT
I have a simple form that's supposed to enter submissions in a MySQL database
I have a MySQL database that has a few very simple tables. I would
I have a simple php/mysql script that stores in mysql database id, link, and
My question: I have a mysql database that consists of something like a fact
I have a small mySQL database and a few simple php based webpages that
I have a simple mySQL database table that I am loading into a PHP
I have a series of varchar fields in a MySQL database that are numbered:
I have a simple shopping cart web site that uses a MySQL database to
I have got a simple MySQL table and primary index (id) is not numbered

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.