I’m not the best with PHP, but that looks wrong.
Can you try connecting using mysqli? If you don’t want to, stackoverflow may be a better spot to ask this (You could also wait for someone else as well).
I’m not the best with PHP, but that looks wrong.
Can you try connecting using mysqli? If you don’t want to, stackoverflow may be a better spot to ask this (You could also wait for someone else as well).
i will try using mysqli, after comeback for say if it’s worked or no. Thank you
i try again with PDO, and return this error:
SQLSTATE[HY000] [2002] No such file or directory, all code are correct.
A quick Google search brings up this:
nothing work, is possible the infinityfree did send me incorrect credentials of mysql?
If you use the MySQL construct does it work?
do want to say mysqli? if yes, i don’t tryed because need change many code lines
Well, can you at least write one line of code to see if it will connect? Then we will know if it is your credentials, PDO, or something else.
ok, i will try now
i tryed with mysqli, and worked, but why don’t work with PDO?
nothing work, return this in console.
Cross-Origin Read Blocking (CORB) blocked cross-origin response https://infinityfree.net/errors/404/ with MIME type text/html. See Chrome Platform Status for more details.
someone know what’s this?
That’s the security policy
Please note the connection parameters of a PDO DSN for MySQL.
https://www.php.net/manual/en/ref.pdo-mysql.connection.php
I see you’re putting the server name into the parameter server
, but that should be host
.
Also, I’m not completely sure, but it might also not like the spaces in the DSN.
So I think you should be able to connect successfully with this line instead:
new PDO("mysql:host={$this->server};dbname={$this->db};charset=utf8", $this->user, $this->pass);
Thank you, worked perfectly. But i’m impressed, because i use the PDO with server and only now appeared problem.
Only more one quest. The infinityfree has support to AJAX with JQUERY?
This might help you:
If you don’t specify host
, it will use the default, which is localhost. And that value works fine for many systems.
So it worked because the default value happened to be right, and the server
parameter was invalid and being ignored.
i understand, thank you so much.
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.