我正在尝试创建一个迷你个人资料,其中显示人员姓名、公司职位、电话号码、电子邮件、简历和个人资料照片的插槽。我的问题是我已经知道如何上传图像并裁剪它们,但是我狂热地搜索却无济于事,试图找出一种可以上传个人资料以链接每个用户 ID 的方法,例如。就像您的 facebook 个人资料图片如何自动链接到您的用户 ID 一样,有什么建议吗?我是否必须使用相同的数据库(Mysql)表才能这样做?或者我可以打电话给一个特定的ID吗?如果我想稍后更改同一个人资料的图片,我是否必须重新创建个人资料?或者有没有办法可以标记每个配置文件并在点击时访问每个配置文件?
<?php
error_reporting(0);
include('connect.php');
if(is_dir('hftpnyc/dir_thumbs') == false ){
mkdir('hftpnyc/dir_thumbs', 0744);}
$dir_pos = mysql_real_escape_string($_POST['Dir_pos']);
$dir_name=mysql_real_escape_string($_POST['Dir_name']);
$occu=mysql_real_escape_string($_POST['Occu']);
$bio = mysql_real_escape_string($_POST['Bio']);
$pic = mysql_real_escape_string($_POST['dir_pic']);
$email = mysql_real_escape_string($_POST['email']);
$Numb = mysql_real_escape_string($_POST['num']);
$cr8 = isset($_POST['cr8']);
$errmsg = array();
$sql= mysql_query("SELECT * FROM `directors`");
$get = mysql_fetch_assoc($sql);
if($cr8){
if( $dir_pos && $dir_name && $occu){
mysql_query("INSERT INTO `hftpnyc`.`directors` (`Positition`,`name`,`Email`,`Num`,`occupation`,`Bio`,`dir_pic`) VALUES ('{$dir_pos}','{$dir_name}','{$email}','{$Numb}','{$occu}','{$bio}','{$encoded}')");
header('location:Directors.php');
}
}
?>
<form name="Director_create" method="post" id="form" actio="<?php echo $_SERVER['PHP_SELF']; ?>"/>
Director position: <br/>
<input class="text_user" id="nick" type="text" name="Dir_pos" MAXLENGTH="55" />
Director name:
<input name="Dir_name" type="text" id="messagebox" />
Contact Number:
<p style="color:#F00; font-size:9px; margin-top:0px; margin-bottom:0px;">*optional*</p>
<input name="num" type="text" id="messagebox" />
Email Address:
<input name="email" type="text" id="messagebox" />
Occupation:
<input name="Occu" cols="20" class="text" id="messagebox" />
Biography:
<textarea ty name="Bio" class="text" id="messagebox" ></textarea>
<br/>
<input id="send" name="cr8" type="submit" value="CREATE" />
</form>
我有代码来显示下面每个配置文件应该回显的内容。
<?php
$query=mysql_query("SELECT * FROM `directors` ORDER BY `Director_id` DESC;") ;
while ($row=mysql_fetch_assoc($query))
{
$email1 = $row['Email'];
$enc = $row['dir_pic'];
$name= $row['name'];
$posit = $row['Positition'];
$num1 = $row['Num'];
$occupation = $row['occupation'];
$Biography = $row['Bio'];
?>
<div id="direc" style="height:10px; width:100%;margin-bottom:8px;">
<h3 class="heading" style="margin:0px auto;color:#666; border-bottom: #A3308E solid 1px;font-family: Tahoma, Geneva, sans-serif; font-size:15px"> <?php echo $posit; ?>: <?php echo $name; ?></h3> </div>
<div class="photocase" style="width:100px; height:100px; float:left;border-width: 1px;border:solid black 1px;margin: 5px; ">
<img src="<?php echo /*This is where i want each photo*/; ?>" width="100px" />
</div>
<div style="width:360px;height:30px; display:block;float:left;margin-top:5px; line-height:3px;">
<p>OCCUPATION: <?php echo $occupation; ?></p>
</div>
<div style="width:360px;height:30px; display:block;float:left;margin-top:5px; line-height:3px;">
<p align="justify">Email: <?php echo $email1; ?></p>
</div>
<div style="width:360px;height:30px; display:block;float:left;margin-top:5px; line-height:3px;">
<p align="justify">Contact #: <?php echo $num1; ?></p>
</div>
<div style="float:left;display:block;width:98%;height:16px;margin-bottom:0px;margin-left:1.5%; ">
<p>Bio:<?php echo $Biography;?></p>
</div>
</div>
<?php
}
?>