Discussion: Lesson 2 - First database table and MySQL PHP drivers
BackComments
Member
10 messages from 10 displayed.
//= Settings::TRACKING_CODE_B ?> //= Settings::TRACKING_CODE ?>
Comments
Yes, it's our wrapper for working with the database.
Exactly what license does this source code use?
It's under ICT.social free license. Basically, the only thing you need to do is to keep our link in the source code. More at https://www.ict.social/licenses
Hello,I am having this issue.. may someone help me please? Thanks!
Fatal error: Undefined class constant 'PDO::MYSQL_ATTR_INIT_COMMAND' in C:\Program Files (x86)\EasyPHP-Devserver-16.1\eds-www\DatabaseTest\Db.php on line 52
Thanks it solved the prob! Now i am running on to another problem, i can not
connect to my database.
Briefly, i am not using the default port of localhost which is supposed to be
'80', i changed it for particular reason to '90' and phpmyadmin is working
fine.
Now when i run this code:
<?php
require_once ('Db.php');
$host = "localhost:90";
$database = "web_database";
$user = "root";
$password = "admin";
$success = Db::connect($host, $database, $user, $password);
if($success){
echo 'Connected!';
}else
echo 'Error occurred';
?>
I got this error message:
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000]
[2002] No connection could be made because the target machine actively refused
it. ' in C:\xampp\htdocs\DatabaseTest\Db.php:54 Stack trace: #0
C:\xampp\htdocs\DatabaseTest\Db.php(54):
PDO->__construct('mysql:host=loca...', 'root', '', Array) #1
C:\xampp\htdocs\DatabaseTest\index.php(8): Db::connect('localhost:90',
'web_database', 'root', '') #2 {main} thrown in
C:\xampp\htdocs\DatabaseTest\Db.php on line 54
Could anybody help?
the wrapper you made , is it necessary to understand it for beginners to database?
Absolutely not, you should be only able to use it
10 messages from 10 displayed.