LAPTOP-V9RRD1TL\Michelle's Computer f8f8fcaf96 first commit
2025-07-21 21:38:17 +08:00

68 lines
2.8 KiB
PHP

<?php
$must_login = true ;
$require_path = '../../../' ;
$require_sub = '../../' ;
require( $require_sub.'header.php' ) ;
if ( $boolean_login ){
$status = '201' ;
$search_query = '' ;
$search_query .= " AND formheadcount_id = '".$array['formheadcount_id']."'" ;
$query = "SELECT formheadcount_id, title, content, remark, comment, status, created_at, updated_at FROM formheadcount
WHERE deleted_at IS NULL " . $search_query ;
$mysqli_query = $mysqli->query( $query . " LIMIT 1" ) ;
if ( $mysqli_query->num_rows > 0 ){
$status = '200' ;
$list = [] ;
$row = $mysqli_query->fetch_assoc() ;
$row['title'] = dataFilter( $row['title'] ) ;
$row['content'] = dataFilter( $row['content'] ) ;
$row['remark'] = dataFilter( $row['remark'] ) ;
$row['comment'] = dataFilter( $row['comment'] ) ;
// get all media
$select_media = $mysqli->query( "SELECT media_id, file, filetype FROM formheadcount_media
WHERE deleted_at IS NULL AND formheadcount_id = '".$array['formheadcount_id']."'" ) ;
$photos = [] ;
if ( $select_media->num_rows > 0 ){
while ( $row_media = $select_media->fetch_assoc() ){
switch ( $row_media['filetype'] ){
case 'jpg' :
case 'jpeg' :
case 'png' :
$photos[] = [
'media_id' => $row_media['media_id'],
'type' => 'online',
'filetype' => $row_media['filetype'],
'file' => ( $row_media['file'] != '' ? PATH.'uploads/FormHeadCount/b/'.$row_media['file'] : '' )
] ;
break ;
default :
$photos[] = [
'media_id' => $row_media['media_id'],
'type' => 'online',
'filetype' => $row_media['filetype'],
'file' => ( $row_media['file'] != '' ? PATH.'uploads/FormHeadCount/'.$row_media['file'] : '' )
] ;
}
}
}
$row['photos'] = $photos ;
$data = $row ;
}
}
require( $require_sub.'footer.php' ) ;
?>