It's a php questionㅜㅜ

Asked 2 years ago, Updated 2 years ago, 46 views

<?php

$com = mysqli_connect("localhost", "123" , "123!" , "123" );

$start = '2018/5/1';

$end = '2018/5/30';



$statement = mysqli_prepare($com, "select * from CARJOIN where DATE(startDay)>= '?' and DATE(startDay)<= '?' ORDER BY startDay DESC ");



mysqli_stmt_bind_param($statement, "ss" , $start , $end);

mysqli_stmt_execute($statement); 

mysqli_stmt_store_result($statement);

$response = array();





while($row = mysqli_fetch_array($statement)){



    array_push($response, array("id"=>$row[0], "carNum"=>$row[1], "startPlace"=>$row[2], "endPlace"=>$row[3]

    ,"startTime"=>$row[4], "startDay"=>$row[5], "endTime"=>$row[6], "endDay"=>$row[7], "no"=>$row[8], "kilometer"=>$row[9] )

    );



}



echo json_encode(array("response"=>$response));

mysqli_close($com);

?>

It's a code that searches all the values between the specified periods, but nothing comes out...

Which part is wrong?ㅜ<

php mysql

2022-09-22 19:57

1 Answers

select * from CARJOIN where DATE(startDay)>= '?' and DATE(startDay)<= '?' ORDER BY startDay DESC

I don't know if it's because startDay comes out twice. According to this query, you need to get something that is greater than or equal to the start date and less than or equal to the start date.


2022-09-22 19:57

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.