Re: Why does my class require the public accessor for my member?
- From: Jerry Stuckle <jstucklex@xxxxxxxxxxxxx>
- Date: Tue, 16 Sep 2008 11:19:47 -0400
jmDesktop wrote:
On Sep 15, 7:53 pm, Jerry Stuckle <jstuck...@xxxxxxxxxxxxx> wrote:jmDesktop wrote:Consider:You don't see any errors because error_reporting and/or display_errors
<?php
echo "start";
class myClass
{
public $connection;
function getme()
{
$this->connection = "test";
return $this->connection;
}
}
$database = new myClass();
$mytest = $database->getme();
echo $mytest;
echo "done";
?>
If I remove the "public $connection" above and have it just as
"$connection," I get nothing. Nothing loads, not start, done,
nothing, no html tags, no errors, nada. Make me thinks it's an error,
but when I use error_reporting, I get nothing also. If I put the
public modifier back in I get the results. I thought I could make
$connection private and access it from my accessor, getme().
What am I doing wrong? And, why doesn't php complain if I did my
class wrong? Thank you.
is disabled.
In your php.ini file, ensure you have:
display_errors=on
error_reporting=E_ALL
Enable these and you'll see your syntax error.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@xxxxxxxxxxxxx
==================- Hide quoted text -
- Show quoted text -
I tried that with:
error_reporting = E_ALL
; Print out errors (as a part of the output). For production web
sites,
; you're strongly encouraged to turn this feature off, and use error
logging
; instead (see below). Keeping display_errors enabled on a production
web site
; may reveal security information to end users, such as file paths on
your Web
; server, your database schema or other information.
;
; possible values for display_errors:
;
; Off - Do not display any errors
; stderr - Display errors to STDERR (affects only CGI/CLI
binaries!)
; On or stdout - Display errors to STDOUT (default)
;
; To output errors to STDERR with CGI/CLI:
;display_errors = "stderr"
;
; Default
;
display_errors On
; Even when display_errors is on, errors that occur during PHP's
startup
; sequence are not displayed. It's strongly recommended to keep
; display_startup_errors off, except for when debugging.
display_startup_errors = On
I just get a blank page. I put the public modifier in it works.
Please see my comment above. It is
display_errors=On
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@xxxxxxxxxxxxx
==================
.
- References:
- Why does my class require the public accessor for my member?
- From: jmDesktop
- Re: Why does my class require the public accessor for my member?
- From: Jerry Stuckle
- Re: Why does my class require the public accessor for my member?
- From: jmDesktop
- Why does my class require the public accessor for my member?
- Prev by Date: Re: Introductory SimpleTest Question
- Next by Date: Re: Why does my class require the public accessor for my member?
- Previous by thread: Re: Why does my class require the public accessor for my member?
- Next by thread: Re: Why does my class require the public accessor for my member?
- Index(es):
Relevant Pages
|