0

can you tell me what's wrong in my code

if (isset($_POST['sumbit'])) { try { $conx = new PDO("mysql:host=localhost; dbname=admin","root",""); } catch (Exception $e) { echo $e -> getMessage(); exit(); } }

3rd Jul 2021, 9:09 AM
Abdelwadoud ACHOUCHE
Abdelwadoud ACHOUCHE - avatar
3 Answers
+ 1
What problem you are dealing with? it's not possible to test such code in SoloLearn. You need to elaborate more in thread's Description in order for people to understand what the problem is, and suggest something proportionally.
3rd Jul 2021, 9:20 AM
Ipang
+ 1
Ok, maybe you can try making new code using try...catch block. And then test it to see if it also gives warning near `try` When I tried your code, I didn't get such warning. Although I do get a note saying driver not available when I tested the PDO initialiization.
3rd Jul 2021, 9:28 AM
Ipang
0
The php compilator says : Parse Error near to the try. I didn't understand what is the problem ?
3rd Jul 2021, 9:24 AM
Abdelwadoud ACHOUCHE
Abdelwadoud ACHOUCHE - avatar