Hello i have an annoying error in my PHP Code. I asked my teacher and he mean that the code should work and he has no idea why this error come. I hope you find the error:
In this Code i try to become a json format:
<?php
$von = $_GET['datumvon'];
$bis = $_GET['datumbis'];
$frei =0;
$DB_server = "localhost";
$DB_name = "dbterminkalenderha";
$DB_user = "root";
$DB_password = "root";
$server = mysqli_connect($DB_server, $DB_user, $DB_password);
$connection = mysqli_select_db($server, $DB_name);
$myquery = $server->prepare("SELECT T_Datum,T_Frei FROM t_terminslots WHERE (T_Datum Between ? AND ?) AND (T_Frei = ?); ");
$myquery->bind_param("ssi",$von,$bis,$frei);
$myquery ->execute();
//$query = mysqli_($myquery);
if ( ! $myquery ) {
echo mysqli_error();
die;
}
$data = array();
for ($x = 0; $x < mysql_num_rows($myquery); $x++) {
$data[] = mysqli_fetch_assoc($myquery);
}
echo json_encode($data);
mysqli_close($server);
?>
Error: Warning: mysql_num_rows() expects parameter 1 to be resource, object given in