관리자가 삭제 버튼을 추가하고 싶지만 작동하지 못합니다. 여기에 내 코드 (주석 라인 모두, 내가 그들을 시도)입니다 :관리자의 데이터베이스에서 행을 삭제합니다.
`<?php `
`$db = JFactory::getDBO();`
`$query = $db->getQuery(true);`
/* ----------------- STERGERE -----------------------*/
`if(isset($_GET['delete']))
{ $query->delete('*');
$query->from('roy_testimonial');
$query->where('testimonial_id = "'.$_GET['delete'].'"');
$db->setQuery($query);
}`
/* ----------------- END STERGERE -----------------------*/
/*-------------- AFISARE ------------------ */
`$query->select('*');`
`$query->from('roy_testimonial');`
`$db->setQuery($query);`
`$options = $db->loadAssocList();`
`foreach($options as $row) {
$firstname = htmlentities($row['firstname']);
$lastname = htmlentities($row['lastname']);
$city = htmlentities($row['city']);
$state = htmlentities($row['state']);
$mesaj = htmlentities($row['user_mesaj']);
$purchase = htmlentities($row['your_purchase']);
$sales = htmlentities($row['sales']);
$financing = htmlentities($row['financing']);
$service = htmlentities($row['service']);
$parts = htmlentities($row['parts']);
$accesories = htmlentities($row['accesories']);
$id = $row['testimonial_id'];`
/* ----------------- END AFISARE -----------------------*/
`?>`
`<div style="float:left;width:600px;">`
`<h2 style="color:#015CB7;"><?php echo $id; ?>) <?php echo $firstname;?> <?php echo $lastname;?>`
`<font style="color:#000;font-size:14px;">(<?php echo $city;echo ','; echo $state;?>)</font></h2>`
`<p>`
`<font style="font-size:14px;font-weight:bold;">Mesaj:</font> <?php echo $mesaj; ?></p>`
`</div>`
`<div style="float:left;width:300px;">`
<!-- RATING -->
`<h2 style="color:#015CB7">Rating</h2>`
`Your Purchase: <?php echo $purchase; ?> <br/>`
`Sales: <?php echo $sales; ?> <br/>`
`Financing and Insurance: <?php echo $financing; ?> <br/>`
`Service: <?php echo $service; ?> <br/>`
`Parts: <?php echo $parts; ?> <br/>`
`Accesories: <?php echo $accesories; ?> <br/>`
`</div>`
`<div style="float:right;width:300px;">`
`<a href="?delete=<?=$id;?>">Sterge</a>`
`</div>`
`<div style="clear:both;"></div>`
`<?php } ?>`
이것은 내가 지금까지 가지고 내가 할 대신에 게시물을 사용해야 무엇인가?
후 그리고'exact' 오류는 무엇인가? http://stackoverflow.com/help/mcve – kmas
아무런 오류가 없으며 행을 삭제하지 않고 있습니다. – RMissy
안녕하세요, 좋습니다. 우선 사용하지 않는 코드를 모두 제거하십시오. 그러면 훨씬 쉽게 읽을 수 있습니다. 둘째,'$ _GET'을 사용하지 말고 [this] (http://docs.joomla.org/Retrieving_request_data_using_JInput)에서 읽으십시오. 'delete' 실행을 위해 두 데이터베이스 쿼리 메소드를 주석 처리했습니다. 어느 것이 사용하고 있습니까? – Lodder