I am trying to create a form where some members can update their profile info.
I would like to run a query against the database to first retrieve their existing info.
I should be able to do that with a query like this:
$conn = db_connect();
$result = $conn->query("select * from directory where directory_id =
(select directory_id from users where username ='$username')");
if (!$result)
{//could not execute query
throw new Exception('<h2>Could not execute query to find the member profile!</h2><p>Error: '
.mysqli_errno($conn)
.mysqli_error($conn)
.'</p>' );
}
else if ($result->num_rows==0)
{// name not found
throw new Exception('<h2>Could not find user in database! </h2><p>Error: '
.mysqli_errno($conn)
.mysqli_error($conn)
.'</p>' );
}
else
{
$row = $result->fetch_object();
//GOT LOST HERE! WANT TO RETURN THE ARRAY AND SEE THE VALUES.
}
So I am lost in the last else statement. I went to get the array variables and then use them in the form fields.
Right now I just want to run the query and echo out the array variable names and values so I can then know where to put them in the form.
How can I display what comes back from the query?
Thanks!