webForumDet fria alternativet

mysqli_select_db() expects exactly 2 parameters

2 svar · 1 242 visningar · startad av K@llen

K@llenMedlem sedan mars 20032 667 inlägg
#1

Hej,

har nog stirrat mig blind, för följande fel:
Warning: mysqli_select_db() expects exactly 2 parameters, 1 given in xxx

Någon skarpsynt människa som se felet?

    public function connect() {
        if ($this -> link = mysqli_connect($this -> host, $this -> user, $this -> pass)) {
            if (!empty($this -> name)) {
                if (!mysqli_select_db($this -> link, $this -> name)) $this -> exception("Could not connect to the database!");
            }
        } else {
            $this -> exception("Could not create database connection!");
        }
    }
cascaMedlem sedan feb. 20005 891 inlägg
#2

Kan man verkligen ha space mellan ett objekt och metod? Dvs. $this -> exception() ska väl vara $this->exception()?

[Edit] tydligen kan man det ;)

K@llenMedlem sedan mars 20032 667 inlägg
#3

Problemet löst. Hade råkat blanda mysqli_xx() och mysql_xx() i klassen, vilket fick allt att flippa ut.

132 ms totalt · 3 externa anrop · v20260731065814-full.0e50b1ef
0 ms — hämta forumlista (cache)
0 ms — hämta statistik (cache)
129 ms — hämta tråd, inlägg och bilagor (db)