$host = 'localhost';
$user = 'root';
$password = '';
$database = 'egov';
$conn = mysql_connect($host, $user, $password) or die('Server Information is not Correct');
mysql_select_db($database, $conn) or die('Database Information is not correct');
$sql = "CREATE TABLE IF NOT EXISTS 'upload'(
file_id INT(11) NOT NULL,
fName VARCHAR(255) NOT NULL,
lName VARCHAR(255) NOT NULL,
Mo INT(11) NOT NULL,
dese VARCHAR(255) NOT NULL,
Email VARCHAR(255) NOT NULL,
file_name VARCHAR(255) NOT NULL,
PRIMARY KEY(file_id))ENGINE = MYISAM";
if (isset($_POST['upload']) && $_FILES['userfile']['size'] > 0) {
$fileName = $_FILES['userfile']['name'];
$tmpName = $_FILES['userfile']['tmp_name'];
$fileSize = $_FILES['userfile']['size'];
$fileType = $_FILES['userfile']['type'];
$fp = fopen($tmpName, 'r');
$content = fread($fp, filesize($tmpName));
$content = addslashes($content);
fclose($fp);
if (!get_magic_quotes_gpc()) {
$fileName = addslashes($fileName);
}
$da = date("dmy");
echo $da;
$fname = $_REQUEST['lastname'];
$lname = $_REQUEST['firstname'];
$pno = $_REQUEST['mbo'];
$email = $_REQUEST['email'];
$query = $_REQUEST['description'];
$sql = "INSERT INTO upload (
fName,
lName,
Mo,
dese,
Email
)
VALUES (
'$fname',
'$lname',
'$pno',
'$email',
'$query ',
'file_name',
NOW()
)";
}
$query = "SELECT * FROM upload";
$result = mysql_query($query);
echo "<table>";
echo "<tr>";
while( ($row = mysql_fetch_array($result)))
{
echo "<tr>";
echo "<td>".$row['fName']."</td>";
echo "<td>".$row['lName']."</td>";
echo "<td>".$row['Mo']."</td>";
echo "<td>".$row['dese']."</td>";
echo "<td>".$row['Email']."</td>";
echo "</tr>";
}
echo "</tr>";
echo "</table>";
データがテーブルに挿入されていません。すでに問い合わせましたが、返信がありませんでした。私のアカウントを台無しにするので、反対票を投じないでください。
私のhtmlコードは次のとおりです。
<input type="hidden" name="MAX_FILE_SIZE" value="2000000">
<input name="userfile" type="file" id="userfile">