업데이트 페이지MYSQL (데이터베이스)에서 내 Bio를 어떻게 업데이트합니까?
<?php
if(isset($_FILES['profile']) === true){
if(empty($_FILES['profile']['name'])===true){
echo 'Please Choose a file';
}else{
$allowed = array ('jpg','jpeg','gif','png');
$file_name = $_FILES['profile']['name'];
$file_extn = strtolower(end(explode('.',$file_name)));
$file_temp = $_FILES['profile']['tmp_name'];
if (in_array($file_extn, $allowed)===true){
change_profile_image(($_SESSION['accts_id']), $file_temp, $file_extn);
header('Location'. $current_file);
}else{
echo 'Incorret file type. Allowed: ';
echo implode(', ', $allowed);
}
}
}
$firstname = getuserfield('firstname');
$profile = getuserfield('Profile');
if(empty($profile ===false)){
echo '<img src="', $profile,'" alt="',$firstname,'\'s Profile Image">';
}
if(isset($_POST['textarea'])){
$textarea = $_POST['textarea'];
if(!empty($_POST['textarea'])){
change_bio_details($_SESSION['accts_id'], $textarea);
header('Location'. $current_file);
}else
{
echo 'Please enter data';
}
}
?>
기능 페이지.
function change_profile_image($accts_id, $file_temp, $file_extn) {
$file_path ='imageuploaded/profile/'. substr (md5(time()), 0,10). '.'. $file_extn;
move_uploaded_file($file_temp, $file_path);
$sql = "UPDATE `accts` SET `Profile` ='". mysql_real_escape_string($file_path) . "' WHERE `id` =" . (int)$accts_id;
mysql_query($sql);
}
function change_bio_details($accts_id, $textarea){
$sql = "UPDATE `accts` SET `Bio` ='".$textarea."' WHERE `id = ". (int)$accts_id;
mysql_query($sql);
}
어디서 문제가됩니까? (그 외에 \'마지막 업데이트에서 .... 어디에서 id = ') – Jeff