私はコーディングにまったく慣れていないので、数か月前に試してから、今週再び始めました。私が以前に古いホストで作業していたコードは、現在、すべての mySQL 情報が取り込まれていないため、機能していないようです! ページはサーバーに接続しますが、それが取得した接続にエラーを入れようとしましたが、行数やドロップダウンボックスにデータを入力することはできません。以下にコードを貼り付けたので、明らかな間違いを確認できます。私の他のコードは、問題なくテーブルに書き込むことができるようです。
ありがとう、
クリス
<html>
<head>
<title>Create a new team</title>
</head>
<body>
<form action="cteam.php" method="post">
<?php
$dbserver='localhost';
$dbusername='******';
$dbpassword='******';
$dbname='*******';
$con = mysql_connect("$dbserver","$dbusername","$dbpassword");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
$result = mysql_query("select count(1) FROM Name");
$row = mysql_fetch_array($result);
$total1 = $row[0];
echo "Current No. of registered Teams: " . $total1;
mysql_close($con);
?>
<br>
Team Full Name: <input type="text" name="longname">
<br>
Team Short Name: <input type="text" name="shortname">
<br>
Link to Logo: <input type="text" name="logo">
<br>
Select Rink or Press Create new Venue link:
<br>
<?php
$query = "SELECT * FROM Rink";
$result = mysql_query($query);
?>
<select name="venue">
<?php
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
?>
<option value="<?php echo $line['Name'];?>"> <?php echo $line['Name'];?> </option>
<?php
}
?>
</select> <a href="http://beerleague.co.uk/pics/cvenue1.html">Create New Venue!</a>
<br>
Website address: <input type="text" name="website">
<br>
Twitter: <input type="text" name="twitter">
<br>
Facebook: <input type="text" name="facebook">
<br>
Link to image of home shirt: <input type="text" name="home_shirt">
<br>
Link to image of away shirt: <input type="text" name="away_shirt">
<br>
Link to image of Alt shirt: <input type="text" name=alt_shirt">
<br>
Team Bio: <input type="text" name="blurb">
<br>
<input type="submit">
</form>
</body>
</html>