I keep getting this error, I have looked at a question raised by a previous poster with this issue and the advice handed out to them has been of no help in resolving my issue, had it done so I certainly would not have raised this query so please dont redirect! I am developing a project where the user registers their details name age, email etc but I want them to have the capability of editing the data It is fine up loding the data to the db, but on trying to retrieve it for the user to view I get the error mysql_fetch_array() expects parameter 1 to be resource, object given
Here is my code
<?php
require_once'connect.php';
$FirstName = $_POST['fName'];
$UserName = $_POST['uName'];
$Age = $_POST['age'];
$Password = $_POST['password'];
$Email = $_POST['email'];
$sql = "INSERT INTO `user` (`First_Name`,`UserName`,`Age`,`Password`,`Email`)
VALUES ('$FirstName','$UserName','$Age','$Password','$Email')";
if(! mysqli_query($con, $sql)){
die("Echo ".mysqli_error($sql));
}else{
header('Location: BankDetails_Form.php');
}
So that uploads the data to the db
Now the code that I use to retrieve it is:
<?php
include 'connect.php';
if(isset($_POST['view'])){
$query = "SELECT `First_Name`,`Username`,`Age`,`Password`,`Email` FROM `user`";
$result = mysqli_query($con, $query)
or die('Error querying database');
while ($row = mysql_fetch_array($result)){
echo $row['First_Name'].''.$row['Username'].''.$row['Age'].$row['Password'].$row['Email'];
}
}
?>
Can anyone possibly point me in the right direction as to why I'm getting that error, again I realise this question has been raised but the previous solutions did not help me.