このファイル'gardens.php'は、 'generalinfo'というテーブルからデータを取得し、 fopen を使用してそのデータを'index.html'というファイルに送信します。ここに問題があります。オプションは 1 つだけです。ここでデモを実行していますGarden Demo <-- これは新しく更新されたページと場所です。ローカルにあるよりも多くのエラーがあります 。
私がやりたいことを達成するためのより良い方法はありますか?
ありがとう!いつも。
ガーデンズ.PHP
<?php
include("connect.php");
$results = mysql_query("SELECT * FROM generalinfo");
while($row = mysql_fetch_array($results)){
$country = $row['country'];
$province = $row['province'];
$city = $row['city'];
$address = $row['address'];
//echo $country;
//echo $province;
//echo $city;
//echo $address;
}
$fd = fopen("index.html","r") or die ("Can not fopen the file");
while ($buf =fgets($fd, 1024)){
$template .= $buf;
}
$template = str_replace("<%country%>",$country,$template);
echo $template;
?>
INDEX.PHP スニペット
<form name="filter" method="get" action="filter.php">
<select class="country" name="country">
<option><%country%></option>
</select>
</form>
CONNECT.PHP
<?php
mysql_connect("mysql.andcreate.com", "*******", "********")or die("Cannot Connect to DB");
mysql_select_db("gardencollective")or die("cannot select the DB table");
mysql_close();
?>