The following is what i did.
Do you mean I need to try the below?
I am running Ubuntu 19.04 and the inportant part of phpinfo() shows the following:
If that is not showing then I would remove/purge your current mysqli/mysql installation and follow this installation guide:
https://www.php.net/manual/en/mysqli.installation.php
Edit:
This maybe more appropriate to your system bcause âI installed Xubuntu 2 weeks agoâ
Yup. That should install the mysqli extension to your PHP engine. You will then need to restart your apache service for the change to take effect.
(For those that follow: The only reason I could deduce for the âmysqli_connect function not definedâ was Extension Not Installed. Fix Installation.)
I think it works.
I need more test
Thank you, m_hutley, and John_Betong
Now my new server has it âmysqliâ.
Thank you, John_Betong.
.
I had a look there, and I think the database name is optional, hence being in square-brackets. Also âIf provided will specify the default database to be used when performing queries.â supports that.
The way I interpret the docs is all parameters are optional, most having the default come from the ini. The exception being the database name which defaults to an empty string.
That doesnât make sense to me, AFAIK an empty string would not be a valid name. My guess is the ânew connectionâ would use the same database as a currently unclosed connection. If so, because connections can close when the script terminates I donât imagine taking advantage of this behavior would be that common. IMHO, even if not technically required, for all practical purposes it might as well be.
Itâs possible to establish a connection to a database server without predefining which database you want to use.
Itâs just shorthand, and most users of a database server only operate on a single database.
Consider something like phpMyAdmin - it doesnt know what database the root user wants to operate on, which is why it presents the list of databases - it doesnt need to connect to any specific database from the get-go.
I think thatâs what I was thinking of - when I started looking at PHP, the samples I was reading would connect to the database server, and then separately select the database. I canât say whether I still do it that way - the database connection code is in a separate include file, and whenever I start something new I just copy one of them and change the details.
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.