This question already has an answer here:
- mysql_fetch_array()/mysql_fetch_assoc()/mysql_fetch_row()/mysql_num_rows etc… expects parameter 1 to be resource or result 31 answers
Warning: mysqli_query() expects parameter 1 to be mysqli, resource given in C:\xampp\htdocs\iapdone2_myprofile.php on line 30 Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, null given in C:\xampp\htdocs\iapdone2_myprofile.php on line 32 Notice: Undefined index: address in C:\xampp\htdocs\22_myprofile.php on line 37 Notice: Undefined index: gender in C:\xampp\htdocs\22_myprofile.php on line 41
<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>