What correction did the user make to the PHP script to resolve the issue?

The issue in the PHP script was that the user was trying to access a property of an object without first checking if the object existed. This caused a "Trying to get property of non-object" error. To resolve this, the user needed to add a null check before trying to access the property.

// Check if the object exists before accessing its property
if ($obj !== null) {
    $propertyValue = $obj->property;
    // Use $propertyValue as needed
} else {
    // Handle the case where $obj is null
}