Hi I am trying to connect to mysql database and retreve one number.
Database has this columns:
ID(int), Datum(date), KID(int).
<!DOCTYPE html>
<html>
<head>
<link type='text/css' rel='stylesheet' href='style.css'/>
<title>PHP!</title>
</head>
<body>
<?php
$month = 11;
$year = 2013;
$list_day = 1;
$mysqli= new mysqli("localhost","root","m62rm8F4","test");
if (mysqli_connect_errno($mysqli)) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
exit();
}
$query = "SELECT `KID` FROM `upis` WHERE (`Datum` = '" . $year . "-" . $month . "-" . $list_day. "')";
$res = $mysqli->query($query);
$row = $res->fetch_array(MYSQLI_NUM);
$intnum = $row[0];
echo $intnum;
?>
</body>
</html>
I only get on screen: query($query); $row = $res->fetch_array(MYSQLI_NUM); $intnum = $row[0]; echo $intnum; ?>
Please help!
What am i doing wrong?