1

I tested the installation using the parse.com instructions and it worked (recorded was added to table). Now I am trying to retrieve the information in the table (2 records), and all I have is a blank page with no errors.

Here is the code:

<?php
require 'vendor/autoload.php';

use Parse\ParseClient;
use Parse\ParseObject;

ParseClient::initialize('djdksjdkks', 'jdksjdksjdksd', 'jdksjdjsdjskdsjdjsdks');

?>

and then later in the page the code I expect to show something:

<?php
                        $query = new ParseQuery("Donations");
                        //$query->equalTo("playerName", "Dan Stemkoski");
                        $results = $query->find();

                        //echo "Successfully retrieved " . count($results) . " scores.");
                        for ($i = 0; $i < count($results); $i++) { 
                            $object = $results[$i];
                            echo $object->getObjectId() . ' - ' . $object->get('fullname'));
                         }
                      ?>

Please help out...I read that if there is a syntax mistake, PHP tends to load a white screen.

2 Answers 2

2

I think you miss the use Parse\ParseQuery; at your code.

Sign up to request clarification or add additional context in comments.

Comments

0

Try this

$query = new ParseQuery("Donations");
$results = $query->find();

foreach ( $results as $result ) {
    // echo user Usernames
    echo $result->getObjectId() . ' - ' . $result->get('fullname'));
}

If you want to track errors, then use a try catch

$query = new ParseQuery("Donations");
try {
    $results = $query->find();
    // The objects was retrieved successfully.
} catch (ParseException $ex) {
    // The object was not retrieved successfully.
    // error is a ParseException with an error code and message.
    echo $ex->getMessage(); 
}

foreach ( $results as $result ) {
    // echo user Usernames
    echo $result->getObjectId() . ' - ' . $result->get('fullname'));
}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.