Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ###############select#################
- Class News
- {
- protected $table='kategori_news';
- public function __construct(){
- //$this->news = $news;
- }
- public function kategori(){
- $records = array();
- $sql = "SELECT id_kategori, kategori from ".$this->table;
- $query = mysql_query($sql) or die(mysql_error());
- if($query){
- while ($result = mysql_fetch_array($query,1)) {
- $records[] = $result;
- }
- }
- return $records;
- }
- }
- --------------------------------view---------------------------
- <select name='kategori'>
- <?php
- foreach($query as $row){
- echo "<option value='$row->id_kategori'>$row->kategori</option>";
- }
- ?>
- </select>
Advertisement
Add Comment
Please, Sign In to add comment