タイトルの本をたどろうとして、zymichost.com を使用しています。
これは私が得るエラーです:
警告: mysql_connect() [function.mysql-connect]: /www/zymichost.com/6/5/4/654456/htdocs/ で、ユーザー '831445_juzer'@'192.168.1.1' (使用するパスワード: YES) のアクセスが拒否されましたphpMM/connect.php の 5 行目
警告: ヘッダー情報を変更できません - /www/zymichost.com/6/ の (/www/zymichost.com/6/5/4/654456/htdocs/phpMM/connect.php:5 で出力が開始された) によって既に送信されたヘッダー5/4/654456/htdocs/phpMM/scripts/app_config.php 25 行目
これは app_config.php ファイルです。
<?php
// Set up debug mode
define("DEBUG_MODE", true);
// Site root
define("SITE_ROOT", "/phpMM/");
// Database connection constants
define ("DATABASE_HOST", "xxxxx");
define ("DATABASE_USERNAME", "xxxxx");
define ("DATABASE_PASSWORD", "xxxxxx");
define ("DATABASE_NAME", "xxxxxx");
// function debug print
function debug_print($message) {
if (DEBUG_MODE) {
echo $message;
}
}
function handle_error($user_error_message, $system_error_message) {
header("Location: show_error.php?" . "error_message={$user_error_message}&" . "system_error_message={$system_error_message}");
exit();
}
?>
これは connect.php コードです。
<?php
require_once 'scripts/app_config.php';
if (!mysql_connect(DATABASE_HOST, DATABASE_USERNAME, "foo")) { handle_error("There was a problem connecting to the database " . "that holds the information we need to get you connected.", mysql_error());
}
echo "<p>Connected to MySQL!</p>";
if (!mysql_select_db(DATABASE_NAME)) {
handle_error("There's a configuration problem with our database.", mysql_error());
}
echo "<p>Connected to MySQL, using database " . DATABASE_NAME . ".</p>";
$result = mysql_query("SHOW TABLES;");
if (!$result) {
handle_error("There's a problem looking up information in our database.", "Error in listing tables: " . mysql_error());
}
echo "<p>Tables in database:</p>";
echo "<ul>";
while ($row = mysql_fetch_row($result)) {
echo "<li>Table: {$row[0]}</li>";
}
echo "</ul>";
?>
最初は空白の問題だと思っていましたが、そうではないと思います。