QUERY 1:
$query = "SELECT myname, DATE_FORMAT(birthdate, '%m/%d/%Y') FROM `personal_info`";
In this query, It works and it gives me the desired format (dd/mm/yyyy), but in another query it gives me an error message.
QUERY 2 (not on the same page):
$query = "SELECT `myname`, `private_ID`, DATE_FORMAT(`birthdate`, '%m/%d/%Y'), `adress`, `phoneno`, `email`, `id` FROM `personal_info` WHERE `private_ID` = $id LIMIT 1";
$result = mysqli_query($conn, $query);
// if id exist
// show data in inputs
if(mysqli_num_rows($result) > 0)
{
while ($row = mysqli_fetch_array($result))
{
$myname= $row['myname'];
$private_ID = $row['private_ID '];
$birthdate= $row['birthdate'];
$adress= $row['adress'];
$phoneno = $row['phoneno '];
$email= $row['email'];
$id= $row['id'];
}
}
(This query #2 is used to fill fetched values from MySQL and insert it into HTML form fields.)
Notice: Undefined index: birthdate in --- on line 31 and line #31 is:
$birthdate= $row['birthdate'];
Where is my mistake here?