Unable to Retrive Entity from table storage!

May 13, 2010 at 9:57 AM

Hi,

I use the following code to fetch the details from a table storage.

   $select = $tableStorageClient->select()->from( $tablename )
                ->where("username eq '".$_POST['uname']."'")
                ->andWhere("password eq '".$_POST['upass']."'")
                ->andWhere('PartitionKey eq ?', $PARTITION);
    
    $adminLogin = $tableStorageClient->retrieveEntities(
      $tablename,
      $select,
      'SiteAdministrator' );

When I run the application, it thrown me the following Fatal Error:

Fatal error: Uncaught exception 'Microsoft_WindowsAzure_Exception' with message 'One of the request inputs is not valid.' in E:\workspace\demoapp\ServiceDefinition.csx\roles\WebRole\approot\admin\Microsoft\WindowsAzure\Storage\Table.php:662 Stack trace: #0 E:\workspace\demoapp\ServiceDefinition.csx\roles\WebRole\approot\admin\login.php(16): Microsoft_WindowsAzure_Storage_Table->retrieveEntities('administrator', Object(Microsoft_WindowsAzure_Storage_TableEntityQuery), 'SiteAdministrat...') #1 {main} thrown in E:\workspace\demoapp\ServiceDefinition.csx\roles\WebRole\approot\admin\Microsoft\WindowsAzure\Storage\Table.php on line 662

Also I try to make $filter by this way:

$select = "PartitionKey eq '".$PARTITION."' and username eq '".$_POST['uname']."' and password eq '".$_POST['upass']."'";

But the same error occurred every time.

Can anyone suggest me about the issue or how to recover it?

Thanks !

Coordinator
May 14, 2010 at 6:17 AM

Can you try this:

  $select = $tableStorageClient->select()->from( $tablename )
                ->where("username eq ?", $_POST['uname'])
                ->andWhere("password eq ?", $_POST['upass'])
                ->andWhere('PartitionKey eq ?', $PARTITION);

Also, can you post a sample of input in uname and upass?

May 14, 2010 at 9:49 AM
Edited May 14, 2010 at 10:18 AM

Hi Maartenba,

I use your suggested code but I received the same fatal error:

$select = $tableStorageClient->select()->from( $tablename )
                ->where("username eq ?", $_POST['uname'])
                ->andWhere("password eq ?", $_POST['upass'])
                ->andWhere('PartitionKey eq ?', $PARTITION);

 $adminLogin = $tableStorageClient->retrieveEntities(
                             $tablename,
                            $select,
                           'SiteAdministrator' );

Please Help Me out for this.

 

Thanks

Coordinator
May 14, 2010 at 11:12 AM

Can you post a sample of input in uname and upass?

May 15, 2010 at 11:02 AM

Hi Maartenba !

I have stored username='admin' and password='admin' in a table 'administrator'. and now I try to create a login application. For this I make 2 input fields as uname and upass.

I have post values as uname='admin' and upass='admin' and try to fetch entity accordingly.

But each time I have received the same fatal error as above.

Thanks