ローカルホストでこのコードを実行できないようです。私の目標は、Webサイトに表示されるはずのテーブルを作成することですが、接続しようとするとエラーが発生します。
警告:mysql_connect():5行目のC:\ xampp \ htdocs \ PhpProject2\hent.phpでは接続できません
my site name: http://localhost/PhpProject2/hent.php
コード:
<html>
<body>
<?php
mysql_connect('<server is here>','<my username here>','<password here>')
or die('can not connect' );
mysql_select_db('<my username here>') or die ('can not connect to <username here>');
$sql = "Select * from Customer";
$result = mysql_query($sql);
$number= mysql_num_rows($result);
for($i=0; $i < $number; $i++)
{
$table = mysql_fetch_row($result);
echo $table[0], $table[1];
echo '<br>';
}
?>
</body>
</html>
私はxamppを使用しており、MySQLはポート3306で実行されています:]
私の<ユーザー名はここ>、<サーバーはここ>、<パスワードはここ>の代わりに実際のコードがあります:]
私はどんな答えにも感謝します:]