[Tutorial] UCP (PHP PDO) Experience Required [SHA1]
#4

There are most definitely better ways to do this. In any case the database credentials should definitely not be global, nor should they be repeated in every file. Database error messages should not be sent directly to the output (unless for debugging) as these can contain sensitive information that an attacker may exploit.

I would recommend using a framework. We use CodeIgniter in class and I quite like the way it works. Configure the database settings and autoload the database driver. Very, very simple.

PHP код:
$this->db->where('username'$username);
$query $this->db->get('player');
$player $query->row();

echo 
$player->username;
echo 
$player->money
Takes a bit of getting used to, but you'll come to love it. There's plenty of documentation available.
Reply


Messages In This Thread
UCP (PHP PDO) Experience Required [SHA1] - by MD5 - 01.11.2015, 02:45
Re: UCP (PHP PDO) Experience Required [SHA1] - by Ritzy2K - 01.11.2015, 04:02
Re: UCP (PHP PDO) Experience Required [SHA1] - by MD5 - 01.11.2015, 12:04
Re: UCP (PHP PDO) Experience Required [SHA1] - by Vince - 01.11.2015, 13:22
Re: UCP (PHP PDO) Experience Required [SHA1] - by N0FeaR - 02.11.2015, 10:23
Re: UCP (PHP PDO) Experience Required [SHA1] - by MD5 - 06.11.2015, 22:46
Re: UCP (PHP PDO) Experience Required [SHA1] - by MD5 - 22.11.2015, 20:48

Forum Jump:


Users browsing this thread: 1 Guest(s)