+ 1

PDO prepare statement issue

I have some problems with PDO Connection?

25th Jun 2017, 7:46 PM
Ahmed Awad
Ahmed Awad - avatar
8 Antworten
+ 1
Ok I will try and i hope it works
25th Jun 2017, 9:00 PM
Ahmed Awad
Ahmed Awad - avatar
+ 1
PDO stands for PHP Data Objects Is used to connect a PHP script with a data base And can be connected as follows $mbd = new PDO('mysql:host=localhost;dbname=test', $user, $password); $stmt = $mdb->prepare('SELECT * FROM a_table'); $stmt->execute();
25th Jun 2017, 7:54 PM
⏩▶Clau◀⏪
⏩▶Clau◀⏪ - avatar
+ 1
When I execute stmt I get an error message, the message is no database selected. and iam shure that my connection parameters is right.
25th Jun 2017, 8:08 PM
Ahmed Awad
Ahmed Awad - avatar
+ 1
In the code, when you write ;dbname= you must specify the correct name of your database
25th Jun 2017, 8:21 PM
⏩▶Clau◀⏪
⏩▶Clau◀⏪ - avatar
+ 1
I do that but i still have an error
25th Jun 2017, 8:39 PM
Ahmed Awad
Ahmed Awad - avatar
+ 1
when i change my dbname and localhost the connection with db is still working, but when i change my pass it dose not work and this is unusually problem
25th Jun 2017, 8:45 PM
Ahmed Awad
Ahmed Awad - avatar
+ 1
Try to use PhpMyAdmin. Probably it can give you a clue
25th Jun 2017, 8:56 PM
⏩▶Clau◀⏪
⏩▶Clau◀⏪ - avatar
0
If it's it's the connection via new PDO() connection try using new msql() connection, also oop
13th Aug 2017, 9:36 PM
ibrahim danjuma
ibrahim danjuma - avatar