警告:mysqli_query()要求参数1为mysqli,第30行的C:\ xampp \ htdocs \ iapdone2_myprofile.php中给出的资源 警告:mysqli_fetch_array()期望参数1为mysqli_result,在第32行的C:\ xampp \ htdocs \ iapdone2_myprofile.php中给出null 注意:未定义的索引:第37行的C:\ xampp \ htdocs \ 22_myprofile.php中的地址 注意:未定义的索引:第41行的C:\ xampp \ htdocs \ 22_myprofile.php中的性别
<html> <div id="myProfile">
<?php
if(($_SERVER["REQUEST_METHOD"] == "POST") and (isset($_POST['editProfile'])))
{
include 'opendatabase.php';
$updateUserDetails="UPDATE users SET email='".$_POST['email']."',address='".$_POST['address']."',gender='".$_POST['gender']."' WHERE username='".$_SESSION['ID']."'";
//mysqli_query($connection,$updateUserDetails) or die(mysqli_error($connection));
include 'closedatabase.php';
header("Refresh: 0; url=userProfile.php");
}//endif
?>
<h2>Personal Details</h2>
<hr/>
<form action="<?php echo 'userProfile.php';?>" method="POST" onsubmit="return profileValidation()" enctype="multipart/form-data">
<table id="profileDetails">
<tr>
<?php
include 'opendatabase.php';?>
<?php
$personalDetails="SELECT email,description,address,gender,join_date FROM users WHERE username='".$_SESSION['ID']."'";
$getPersonalDetails=mysqli_query($connection,$personalDetails);
$rowPersonalDetails=mysqli_fetch_array($getPersonalDetails);
if($rowPersonalDetails['email']==NULL)
{
$rowPersonalDetails['email']="-";
}
if($rowPersonalDetails['address']==NULL)
{
$rowPersonalDetails['address']="-";
}
if($rowPersonalDetails['gender']==NULL)
{
$rowPersonalDetails['gender']="-";
}
?>
</tr>
<tr>
<td>Username:</td>
<td><?php echo $_SESSION['ID'];?><hr/></td>
</tr>
<tr>
<td>Email:</td>
<td><?php echo $rowPersonalDetails['email'];?><hr/></td>
</tr>
<tr>
<td>Address:</td>
<td><?php echo $rowPersonalDetails['address'];?><hr/></td>
</tr>
<tr>
<td>Gender:</td>
<td><?php echo $rowPersonalDetails['gender'];?><hr/></td>
</tr>
<tr>
<td>Join Date:</td>
<td><?php echo $rowPersonalDetails['join_date'];?><hr/></td>
</tr>
<tr>
<td></td>
<td><input type="button" onclick="editProfile()" value="Edit"></td>
</tr>
</table>
</form>
</div>
答案 0 :(得分:1)
您可能正在使用mysql和mysqli函数。坚持mysqli功能。确保你没有混淆这些功能
答案 1 :(得分:0)
使用mysqli
更新连接文件<html>
<?php
$connection = mysqli_connect("localhost", "root", ""); // Establishing Connection with Server
$db = mysqli_select_db($connection, "test")or die("cannot select DB"); // Selecting Database from Server
?>
</html>