Answer the question
In order to leave comments, you need to log in
Removing an entry from the database using a snippet (modx evo)
Greetings!
The question is this: in the snippet I display records from the database:
<?php
global $modx;
$output = '';
$result = $modx->db->query( 'SELECT id, fullname, subject FROM `orders`' );
if( $modx->db->getRecordCount( $result ) >= 1 ) {
$output .= '<ul>';
while( $row = $modx->db->getRow( $result ) ) {
$output .= '<tr><td>'.$row['id'].'</td>';
$output .= '<td>'.$row['fullname'].'</td>';
$output .= '<td>'.$row['subject'].'</td>';
$output .= '<td>'.$row['message'].'</td>';
$output .= '<a name="del" href="?del='.$row['id'].'">Удалить</a></tr><br>';
}
}
else {
$output = 'There are no records to show.';
}
return $output;
?>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question