I have the following problem, I am trying to change the year of the dates I have in my database, and for this I am using:
mysqli_fetch_row
But I am not succeeding, returns always fails. I also made a connection to the database and apparently it is working because it does not return with error. I really appreciate any kind of help. If the question is not clear enough, please request that I make the necessary amendments. Thanks
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 />";
}