开发者

PHP: Parse error: syntax error, unexpected T_STRING in C:\wamp\mysqli_connect.php on line 8

Hi I am trying to get a basic web page using code from http://www.larryullman.com/books/php-6-and-mysql-5-for-dynamic-web-sites-visual-quickpro-guide-3rd-edition/

I am getting this error when I click on the "View User's" link in this webpage. There is more code which I will post if necessary although. The line in question is bolded.

<?php - mysqli_connect.php

// This file contains the database access information. 
// This file also establishes a connection to MySQL 
// and selects the database.

// Set the database access information as constants:
**DEFINE ('DB_USER', 'username');**
DEFINE ('DB_PASSWORD', 'password');
DEFINE ('DB_HOST', 'localhost');
DEFINE ('DB_NAME', 'sitename');

// Make the connection:
$dbc = @mysqli_connect (DB_HOST, DB_USER, DB_PASSWORD, DB_NAME) OR die ('Could not connect to 开发者_JAVA技巧MySQL: ' .mysqli_connect_error() );

?>


Did you mean define('DB_USER', 'username'); ?

And I think that - mysqli_connect.php should be removed.


On the first line, remove the - mysqli_connect.php part because that is not valid PHP. If you want to include it, change the first line to <?php // mysqli_connect.php.

EDIT: I corrected my post because my initial thought was completely wrong

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜