PDO Connection

NorseMan

Member
When it comes to: $pdo = pdoConnect(); . Should I put the database name between () and put it in "......" ?

And when it comes to: $pdo = new pdo('.......*);
Must new PDO be written with capital letters or can it I write it like new pdo?

What is corrext:
new PDO or new pdo?
 
Class names are case insensitive so it can be new pdo, new PDO, new Pdo or even new pDo, but the first parameter may be case sensitive (depends on database).
But good pratcice is using PascalCase in this example it will be new Pdo or new PDO (becuse each character is from one word)
 
Thanks, I will try new PDO. Thats how it says in my book, but in the script i have written i use small letters new pdo. The variabels I write I know it's case sensitive. But i am really struggling with i wrote long time ago, and now i have rewritten this to PDO, or at least i try, but i am not so good to this anymore since i have been away from programming for more than 12 - 13 years. SoI have used more than a year on this rewriting. But then i see. I have to change a lot since i have wrote pdo and not PDO as i should.
 
Use F2 or Ctrl + F2 (I don't remember this key combination) in vscode to replace all new pdo to PDO at once
 
Back
Top