警告: mysql_connect(): C:\xampp\htdocs\ramya\store.php のユーザー 'root'@'localhost' のアクセスが拒否されました (パスワードを使用: YES) 37 行目で localhost に接続できませんでした: ユーザー 'root のアクセスが拒否されました'@'localhost' (パスワードを使用: はい)
<?php
error_reporting(E_ALL);
$server = "localhost";
$login = "root";
$s_password = " ";
$hotel_name=$_POST['hotel_name'];
$street_name=$_POST['street_name'];
$city=$_POST['city'];
$state=$_POST['state'];
$country=$_POST['country'];
$zipcode=$_POST['zipcode'];
$phone_number=$_POST['phone_number'];
$fax=$_POST['fax'];
$email_id=$_POST['email_id'];
$pass=$_POST['password'];
foreach ($_FILES["pictures"]["error"] as $key => $error) { //used for multiple uploads
if ($error == UPLOAD_ERR_OK) {
$tmp_name = $_FILES["pictures"]["tmp_name"][$key];
}
}
$size = getimagesize($tmp_name);
$width = $size[0]; // get width of the image
$height = $size[1]; //get height of the image
$type = $size[2]; //get type of the image
$mime_type = $size['mime']; //get MIME of the image
if(!$data = addslashes(@fread(@fopen($tmp_name, "r"), @filesize($tmp_name)))){
die("\n<BR>Cannot read temp file: $tmp_file");
}
$link = mysql_connect($server, $login, $s_password);
if (!$link) {
die("\n<BR>Could not connect $server:" . mysql_error());
}
$db_selected = mysql_select_db("test");
if (!$db_selected) {
die ("\n<BR>Can\'t use Table : $db_selected" . mysql_error());
}
$query = "INSERT INTO image_data ";
$query .= " (hotel_name,street_name,city,state,country,zipcode,phone_number,fax,email_id,password,image_type, image_width, image_height, image_data) ";
$query .= " values ";
$query .= " ('$hotel_name','$street_name','$city','$state','$country','$zipcode','$phone_number','$fax','$email_id','$pass','$mime_type', '$width', '$height', '$data') ";
$result = mysql_query($query);
if (!$result) {
$message = '<BR>Invalid query: ' . mysql_error() . "\n";
die($message);
}
$image_id = mysql_insert_id() ;
echo "\n<IMG SRC=\"getimage.php?id=$image_id\" />";
mysql_close($link);
exit();
?>