You are here: Re: Problem making a class extending another « PHP Language « IT news, forums, messages
Re: Problem making a class extending another

Posted by Stefan Rybacki on 11/13/85 11:20

Peter wrote:
>>To get further help you should present some code you are using. And I
>>don't mean the code of the pear class. I mean just the code you use to use
>>the pear class.
>>
>>Regards
>>Stefan
>
>
> Hi
>
> I have taken out any unnecessary code.
>
> class my_class extends DB
> {
> function check_user($user_name)
> {
> global $_SERVER;
> $sql = 'select * from users where username =
> \''.htmlspecialchars($user_name).'\' AND browser =
> md5(\''.mysql_real_escape_string($_SERVER['HTTP_USER_AGENT']).'\') AND
> session_id = md5(\''.htmlspecialchars(session_id()).'\')';
> $confirm_user = parent::query($sql);
> if ($confirm_user->numRows()==1)
> {
> $_SESSION['logged_in'] = true;
> }
> }
> }
>
> as you can see I have tried parent::query($sql); I have also tried
> DB::query($sql); but that does not work either, in both cases it displays an
> error saying the following:-
>
> Fatal error: Call to undefined function: db() in
> /home/petermcd/public_html/the.php on line 25
>
>
I'm not very familar with the pear packages. As I can see is query a
method of a class called DB. And since you derived your class of DB you
should simply call query() without anything before (e.g. parent or DB).

Another thing that makes me stuck is that the error message tells you
something about a function called db() and I don't see such a function
in your code?!

Regards
Stefan

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация