PDO Connection

Codes here !

Moderators: gesf, Michalio

Post Reply
User avatar
NorseMan
php-forum Fan User
php-forum Fan User
Posts: 65
Joined: Mon Jul 04, 2022 5:25 pm
Location: Near Oslo (Norway)

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?
________________
Leon (Norway)
________________

-------
(some of)My configuration is:
Laragon full 5.0 web server with PHP and MySQL installation
(Apache 2.4.47 / PHP 7.4.19 / MySQL 5.7.33)
-------
My toolbox and workbench:
Navicat for MySQL 16.0.13
FileZilla 3.57.1
Among others
-------
Development toolbox:
Adobe DreamWeaver 21.2
Adobe Photoshop 23.1.0
Adobe Illustrator 26.0.2
Adobe InDesign 17.0.1
Adobe XD
Visual Studio Code 1.63.2 (with some extensions enabled)
User avatar
Michalio
Moderator
Moderator
Posts: 337
Joined: Sun Jul 18, 2021 1:33 pm
Location: Poland

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)
Free coding lessons: https://php-forum.com/phpforum/viewtopic.php?t=29852
User avatar
NorseMan
php-forum Fan User
php-forum Fan User
Posts: 65
Joined: Mon Jul 04, 2022 5:25 pm
Location: Near Oslo (Norway)

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.
________________
Leon (Norway)
________________

-------
(some of)My configuration is:
Laragon full 5.0 web server with PHP and MySQL installation
(Apache 2.4.47 / PHP 7.4.19 / MySQL 5.7.33)
-------
My toolbox and workbench:
Navicat for MySQL 16.0.13
FileZilla 3.57.1
Among others
-------
Development toolbox:
Adobe DreamWeaver 21.2
Adobe Photoshop 23.1.0
Adobe Illustrator 26.0.2
Adobe InDesign 17.0.1
Adobe XD
Visual Studio Code 1.63.2 (with some extensions enabled)
User avatar
Michalio
Moderator
Moderator
Posts: 337
Joined: Sun Jul 18, 2021 1:33 pm
Location: Poland

Use F2 or Ctrl + F2 (I don't remember this key combination) in vscode to replace all new pdo to PDO at once
Free coding lessons: https://php-forum.com/phpforum/viewtopic.php?t=29852
User avatar
NorseMan
php-forum Fan User
php-forum Fan User
Posts: 65
Joined: Mon Jul 04, 2022 5:25 pm
Location: Near Oslo (Norway)

Great, Thanks 😊👍
________________
Leon (Norway)
________________

-------
(some of)My configuration is:
Laragon full 5.0 web server with PHP and MySQL installation
(Apache 2.4.47 / PHP 7.4.19 / MySQL 5.7.33)
-------
My toolbox and workbench:
Navicat for MySQL 16.0.13
FileZilla 3.57.1
Among others
-------
Development toolbox:
Adobe DreamWeaver 21.2
Adobe Photoshop 23.1.0
Adobe Illustrator 26.0.2
Adobe InDesign 17.0.1
Adobe XD
Visual Studio Code 1.63.2 (with some extensions enabled)
Post Reply