FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Converting Perl to PHP, testing CLI with $_POST (newbie)
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Converting Perl to PHP, testing CLI with $_POST (newbie) [message #172098 is a reply to message #172092] Sun, 30 January 2011 19:50 Go to previous messageGo to previous message
Felix Saphir is currently offline  Felix Saphir
Messages: 8
Registered: December 2010
Karma:
Junior Member
P E Schoen <paul(at)pstech-inc(dot)com> wrote:

> "Felix Saphir" wrote in message
> news:ii3cse$1n2$02$1(at)news(dot)t-online(dot)com...
>
>> $dbfile is unknown to this function, it's not in scope. You
>> could declare it as global here, but your best choice is to
>> pass the filename as parameter to __construct():
>
> I changed it as you suggested:
>
> $dbfile = 'SCGBG_Data.db'; // In global space
>
> class MyDB extends SQLite3
> {
> public function __construct($filename)
> {
> $this->open($filename);
> }
> }
>
> $db = new MyDB($dbfile);
>
> It fails with the same error. I also tried:
>
> $db = new SQLite3($dbFile);
>
> But the following works OK:
>
> $db = new SQLite3('SCGBG_Data.db');
>
> or
>
> $db = new MyDB('SCGBG_Data.db');

That's virtually impossible, there shouldn't be a difference
between using a variable and a string constant. Check your code
for typos (e.g. you're using $dbFile and $dbfile). Are you sure
about the value of $dbfile/$dbFile?


>> BTW it's all in the manual ...
>
> Could you please provide a URL for that? I used the example
> from: http://www.php.net/manual/en/sqlite3.open.php

Oh, the manual is a good read in any case. Just a few starting
points to what I was referring to:

Variable scope:
<http://www.php.net/manual/en/language.variables.scope.php>

Object member visibility:
<http://www.php.net/manual/en/language.oop5.visibility.php>

Object constructors and inheritance:
<http://www.php.net/manual/en/language.oop5.decon.php>

Felix
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: passing variable to a nested array
Next Topic: Stats comp.lang.php (last 7 days)
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 23 20:01:44 GMT 2024

Total time taken to generate the page: 0.05298 seconds