mysql - WebMatrix PHP Query Not working -


just heads have been writing php 3 days. having trouble query. when run query in query tool finds looking for. have tried every variation of syntax can think of using (how right now) , = , cannot work. sure there simpler way rest of code main concern right query. help.

        $incident_d = $_post['incident_d'];         $incident_d = strtotime($incident_d);         $incident_t = $_post['incident_t'];         $incident_t = strtotime($incident_t);         $incident_t = ($incident_t % 86400);         $incident_dt = $incident_d + $incident_t;          $sql = "select dept.department department dept inner join near_miss nm on dept.dept_index = nm.dept_index nm.incident_dt '%" . $incident_dt . "%'";         $result = mysqli_query($conn, $sql);         if (mysqli_num_rows($result) > 0) {             // output data of each row             while($row = mysqli_fetch_assoc($result)) {                 $result1 = $row['department'];             }             } else {                 $result1 = "no response";             }         $result = $result1; 

if manually type in value $incident_dt able find it. why think problem in how value being stored in $incident_dt. when echo value variable , paste query tool works.

$sql = "select dept.department `department` dept inner join near_miss nm on dept.dept_index = nm.dept_index nm.incident_dt '%" . $incident_dt . "%'"; 

the tick necessary php on tablename.


Comments

Popular posts from this blog

javascript - oscilloscope of speaker input stops rendering after a few seconds -

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -