JQuery php pdo
- Szczegóły
- Kategoria: Class
- Opublikowano: piątek, 10, styczeń 2014 16:41
- Super User
- Odsłony: 62282
Jquery php pdo
Jak w łatwy sposób możemy usunąć dynamicznie rekord po rekordzie z tabeli html
wyświetlane przez pętlę foreach, po unikatowym id, za pomocą jquery pdo i php.
/* * @version dynamik v1.0 * @autor Adam Berger$ * Copyright 2014 dynamik * ber34$o2.pl * Licensed under the Apache License v2.0 * http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ class class_dynamik{ public $user; public $html; public function select_(){ try{ if($this->sesionn === true){ $this->db->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC); $stmt = $this->db->prepare('SELECT * FROM `'. $this->db->dbprefix().'banner` WHERE w_pkt>6 and aktywny=1 order by pkt DESC'); /// DESC ASC $stmt->bindValue(':id', $rows['id_banner'], PDO::PARAM_INT); $stmt->execute(); if (!$stmt){ // $this->log->log_user($this->db->errorInfo()); /// zapis logów do bazy danych } if($stmt->rowCount()>0){ $row = $stmt->fetchALL(); $stmt->closeCursor(); $this->html=''; ?> html.=''; $this->html.=''; $this->html.=''; $this->html.=' '; return $this->html; }else{return '';} } }catch(PDOException $e){ // $this->log->log_pdo($e); /// logi z PDO echo 'Połączenie loguj nie mogło zostać utw. '.$e->getMessage().' '.strval($e->getCode()).' '.$e->getFile().' '. $e->getTrace().' '.strval($e->getLine()).' '.$e->getPrevious(); } } }
Komentarze