开发者

Missing argument 1 for my function

开发者 https://www.devze.com 2023-03-24 06:57 出处:网络
Here\'s my class: <?php class eshop_log extends baseDB { function insert($tel,$eshop_id,$log) { $this->insert();

Here's my class:

<?php
    class eshop_log extends baseDB {


        function insert($tel,$eshop_id,$log) {

            $this->insert();
        }

    }

?>

And here's how I using it:

$tel=  $_POST['telephone'] ;
$id= $_POST['id'] ;
$log="log";
$e_l= new eshop_log();
$e_l-开发者_开发百科>insert($tel,$id,$log);

Why am I getting Missing argument 1 for eshop_log::eshop_log()??

Thanks a ton


This has something to do with your baseDB class. Look into this class, how does the constructor look like? If there is something like:

public function __construct($var) {

}

you need to pass a parameter to the constructor:

$e_l = new eshop_log($var);


Inside

function insert($tel,$eshop_id,$log)

you call again this insert() method without passing any arguments.

You have to check, what arguments has parent's insert() method.

However, calling parent's method should looks like:

parent::insert();
0

精彩评论

暂无评论...
验证码 换一张
取 消