1
I have the following problem, I am trying to change the year of the dates I have in my database, and for that I am using:
mysqli_fetch_row
But I am not succeeding, it always returns failed. I also made a connection to the database and apparently it is working because it does not return with error. I would very much appreciate any assistance provided. If the question is not properly clear, please ask, and I will make the appropriate changes. Thank you
Code:
<?php
//Create a database connection
$dbhost = "localhost";
$dbuser = "root";
$dbpass = "";
$dbname = "bd-aircaw-1";
$connection =mysqli_connect($dbhost,$dbuser,$dbpass,$dbname);
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$query = "SELECT * ";
$query .= "FROM voo ";
$query .= "WHERE DataPartida = 2014-11-01 18:00:00";
$result = mysqli_query($connection, $query);
if(!$result) {
die ("Database query failed.");
}
while($row = mysqli_fetch_row($result)){
var_dump($row);
echo "<hr />";
}
Date values should be in single quotes.
– rray
I already modified the quotes for simple but no effect continues to give error "Database query failed."
– angelfmf