jonathan
-
Posts
2 -
Joined
-
Last visited
Posts posted by jonathan
-
-
Hi,
I'm at chapter 9 and trying to create the php file, 'mysqli_connect.php'. I've made the file, saved it, loaded it but all I get is 'syntax error'. I've experimented with commenting out individual lines of code but always the same message appears, only pointing to a different line: suggesting all the code is wrong!
I copied it exactly as in the book (it should be recognised!):
<?php mysqli_connect.php
DEFINE ('DB_USER', 'xxxx');
DEFINE ('DB_PASSWORD', 'xxxx');
DEFINE ('DB_HOST', 'localhost:8888');
DEFINE ('DB_NAME', 'sitename');
//make the connection
$dbc = @mysqli_connect (DB_HOST, DB_USER, DB_PASSWORD, DB_NAME) OR die ('Could not
connect to MySQL: ' . mysqli_connect_error() );
//set the encoding...
mysqli_set_charset($dbc, 'utf8');The username and password I use are ones I set when I created myself as a user of the database 'sitename', entering myself into the 'users' table. Are these the right values to use?
I have checked that MySQLI is running.....so I don't know why there is a problem here...help?
Chapter 9 Connecting To Mysql - 'syntax Error"!
in PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (2nd Edition)
Posted
Thank yooouuu, HartleySan! Do I feel stupid.....