このコードがありますが、実行しようとすると、次のエラーが発生します。
Fatal error: Cannot redeclare genereerLiveCodeP() (previously declared in livestream.php:33) in livestream.php on line 32.
session_start();
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
//header("location: index.php");
if($_SESSION['***'] == '***'){
$fp = fopen("test.html", 'w');
fwrite($fp, "");
fwrite($fp, '<p class="green">*** is online</p>');
$result = mysql_query("select count(1) FROM ***");
$row = mysql_fetch_array($result);
$rows = $row[0]+1000;
echo "Rows: ".$rows."\n";
for ($id = 1000; $id < $rows; $id++) {
echo "ID: ".$id."\n";
function genereerLiveCodeP () {
$lengthCode = 6;
$characters = '1234567890abcdefghijklmnopqrstuvwxyz';
$liveCodeFunction = '';
for ($p = 0; $p < $lengthCode; $p++) {
$liveCodeFunction .= $characters[mt_rand(0, strlen($characters))];
}
return $liveCodeFunction;
}
$livecode = genereerLiveCodeP ();
echo "Livecode: ".$livecode."\n";
$x = mysql_query("UPDATE *** SET livecode='".$livecode."' WHERE *** = '".$***."'");
echo $x."\n";
}
}
私は何をすべきか?