Hello everybody,
I want to write php script with classes, but I haven't enought knowledges. I want to delete multiple rows from mysql with chekbox, but I am wrong. I will be very happy if somebody responds me. This is my code
function showNews(&$sHtml)
{
$sHtml.='<input type="submit" name="btnDel" value="delete"/>';
$aNews = array();
// if ( isset($_POST['btnDel']) )
// {
// $sHtml.='admIndex.php?cmd=delNews&news_id='.$aNews[$i]['news_id'].';
// }
$oDbQ = new DatabaseQuery();
$sQuery = "SELECT * FROM news ORDER BY date DESC";
$iDBres = $oDbQ->readQuery($sQuery);
while($row = mysqli_fetch_assoc($iDBres))
{
$aNews[] = array( 'news_id' => $row['news_id']
, 'news_title' => $row['news_title']
, 'content' => $row['content']
, 'date' => $row['date']
);
}
mysqli_free_result($iDBres);
$oDbQ->connClose();
if ( count($aNews) > 0 )
{
$sHtml.='<div class="scrollbar">'; //
$sHtml .= '<table width="50%">';
$sHtml .= '<tr style="background-color: #c1c1c1">';
$sHtml.='<th></th>';
$sHtml .= '<th>title</th>';
$sHtml .= '<th>news</th>';
$sHtml .= '<th>date</th>';
for($i=0; $i<count($aNews); $i++)
{
$class = '';
if ( ($i%2) != 0 )
$class = ' style="background-color: #c1c1c1" ';
$sHtml .= '<tr'.$class.'>';
$sHtml.='<td><input name="chek" type="checkbox" value="<?php echo
$aNews[$i][news_id];?>"></td>';
// $sHtml .= '<td>'.$aNews[$i]['news_id'].'</td>';
$sHtml .= '<td>'.$aNews[$i]['news_title'].'</td>';
$sHtml .= '<td>'.$aNews[$i]['content'].'</td>';
$sHtml .= '<td>'.$aNews[$i]['date'].'</td>';
$sHtml .= '</tr>';
}
$sHtml.='</table>';
}
unset($aNews);