如何以表格形式回显Parse.com的查询结果?解析PHP SDK

时间:2015-10-25 16:58:22

标签: php html parse-platform

我正在尝试从Parse.com检索此类并在php网站中以表格形式显示它。如果有人能告诉我一个如何完成的例子,将会非常有帮助。凭借很少的HTML和PHP知识,一切都让人感到困惑。

     <?php
     include('parsekey.php');

     use Parse\ParseQuery;

     try{
       $query = new ParseQuery("Stock");
       $query->select("Stock");
       $results = $query->find();

       echo "RESULT: ";

       print_r($results);
       echo "Successfully retrieved " . count($results) . " data.";
        } 
     catch (Exception $e){
    echo $e->getMessage();
     }

     ?>

1 个答案:

答案 0 :(得分:0)

简单....只是循环它们。

 try{
   $query = new ParseQuery("Stock");
   $query->select("Stock");
   $results = $query->find();

   foreach($results as $result){$column_value = $result->get('column_name');}
   echo "Successfully retrieved " . count($results) . " data.";
    } 
 catch (Exception $e){
echo $e->getMessage();
 }

 ?>