WEB BERITA

davv · Jul 22, 2011
Newbie, mau nanya bagaimana perancangan database web berita, apakah image disimpan dalam database atau dalam folder? kalau dalam database apakah tidak sulit untuk menampilkannya... .

Lihat semua 3 jawaban

Silahkan login untuk menjawab!
kakak2 mau tnya saya punya script begini :

<html>
<head>
<title></title>
</head>
<body>
<table>
<form action="<?php $_SERVER; ?>" method="post">
<tr>
<td>No Juri</td>
<td>:</td>
<td><input name="no_juri" type="text" size="20" maxlength="30" /></td>
</tr>
<tr>
<td>Nama Juri</td>
<td>:</td>
<td><input name="nama_juri" type="text" size="100" maxlength="100" /></td>
</tr>

<tr>
<td height="52"></td>
<td></td>
<td><input type="submit" name="kirim" value="SUBMIT" />
<input type="reset" name="reset" value="RESET" /></td>
</tr>
</form>
</table>
</center>

<p>
<?
include ('koneksi.php');
?>
<?
$no_juri=$_POST;
$nama_juri=$_POST;

if (($no_juri=="") or ($nama_juri=="")){
echo "";}
else{

$sqlstr= "insert into t_juri(NO_JURI,NAMA_JURI)values('$no_juri','$nama_juri')";

$sql=ociparse($conn,$sqlstr);
$cek = ociexecute($sql);
ocicommit($conn);


if ($cek) {
echo "Proses simpan berhasil dilakukan";
}

else {

echo "Proses simpan gagal dilakukan";}
}
?>


</div>
</body>
</html>
ketika saya masukkan data no_juri dan nama_juri dan submit tidak muncul "proses simpan berhasil dilakukan" , pas saya cek database oracleny datany g masuk.


thanks
veetha

Lihat semua 55 jawaban

Silahkan login untuk menjawab!
mas, gimana cara membandingkan isi dalam array ?
misalnya saya punya variabel $tes[] yang berisi 4 data, anggap saja
$tes[0] berisi data 4
$tes[1] berisi data 4
$tes[2] berisi data 1
$tes[3] berisi data 5
nilai data bersifat dinamis ttpi indeks array tetap sebanyak 4, nilai data bisa saja berubah2, gak tetap kaya contoh mas.
jika salah satu indeks dibandingkan dgn indeks lain ternyata hasilnya bernilai sama, maka di deklarasikan $a=0

Lihat semua 7 jawaban

Silahkan login untuk menjawab!
kakak2.. maaf saya mau tanya saya punya script php seperti ini :
<?php
session_start();
include "koneksi1.php";
$conn=ocilogon($user,$password,$host_db);
$username = $_POST;
$password = $_POST;
$query = "SELECT * FROM t_login WHERE username = '$username'";
$sql3=ociparse($conn,$query);
$cek3 = ociexecute($sql3);
ocicommit($conn);
// cek kesesuaian password
if ($password == $cek3)
{
//echo "<h1>Login Sukses</h1>";
// menyimpan username dan level ke dalam session
$_SESSION = $cek3;
$_SESSION = $cek3 ;
echo "<h1>Login Sukses<br></h1>";
echo "<h2>Tunggu Sebentar</h2>";
echo "<META HTTP-EQUIV=Refresh CONTENT='2; URL=index.php'>";
}
else
{
echo "<h1>Login gagal</h1>";
echo "<META HTTP-EQUIV=Refresh CONTENT='2; URL=login.php'>";
}
?>
nah yang saya bingung kenapa script ini tidak bisa redirect ke index.php kak... index.php itu adalah halaman selanjutnya yang berisi menu2 utama sesuai dengan sessionnya (apa dia admin, panitia, apa juri?) dan login.php berisi halaman login (username dan password)
tetapi yang saya bingung dan merasa aneh adalah dihalaman browser tempat kita mengetik url dia sudah index.php... tetapi isinya belum index.php malah isinya login.php

thanks..
veetha^^

Lihat semua 19 jawaban

Silahkan login untuk menjawab!
saya ingin bertanya bagaimana cara menampilkan tampilan image ke flexigrid?
ini code flexigrid_helper:
<?php  if (!defined('BASEPATH')) exit('No direct script access allowed'); 
/**
 * Flexigrid CodeIgniter implementation
 *
 * PHP version 5
 *
 * @category  CodeIgniter
 * @package   Flexigrid CI
 * @author    Frederico Carvalho (frederico@eyeviewdesign.com)
 * @version   0.3
 * Copyright (c) 2008 Frederico Carvalho  (http://flexigrid.eyeviewdesign.com)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
*/
if (! function_exists('build_grid_js'))
{
	/**
	 * Build Javascript to display grid
	 *
	 * @param	grid id, or the div id
	 * @param	url to make the ajax call
	 * @param	array with colModel info: 		 
	 * 			* 0 - display name
	 *	 		* 1 - width
	 *	 		* 2 - sortable
	 *			* 3 - align
	 * 			* 4 - searchable (2 -> yes and default, 1 -> yes, 0 -> no.)
	 * 			* 5 - hidden (TRUE or FALSE, default is FALSE. This index is optional.) 
	 * @param	array with button info: 	
	 * 		 	* 0 - display name
	 *	 		* 1 - bclass
	 *	 		* 2 - onpress
	 * @param	default sort column name
	 * @param	default sort order
	 * @param	array with aditional parameters
	 * @return	string
	 */
	function build_grid_js($grid_id,$url,$colModel,$sortname,$sortorder,$gridParams = NULL,$buttons = NULL)
	{
		//Basic propreties
		$grid_js = '<script type="text/javascript">$(document).ready(function(){';
		$grid_js .= '$("#'.$grid_id.'").flexigrid({';
		$grid_js .= "url: '".$url."',";
		$grid_js .= "dataType: 'json',";
		$grid_js .= "sortname: '".$sortname."',";
		$grid_js .= "sortorder: '".$sortorder."',";
		$grid_js .= "usepager: true,";
		$grid_js .= "useRp: true,";
		
		//Other propreties
		if (is_array($gridParams))
		{
			//String exceptions that dont have ' '. Must be lower case.
			$string_exceptions = array("rpoptions");
			
			//Print propreties
			foreach ($gridParams as $index => $value) {
				//Check and print with or without ' '
				if (is_numeric($value)) {
					$grid_js .= $index.": ".$value.",";
				} 
				else 
				{
					if (is_bool($value))
						if ($value == true)
							$grid_js .= $index.": true,";
						else
							$grid_js .= $index.": false,";
					else
						if (in_array(strtolower($index),$string_exceptions))
							$grid_js .= $index.": ".$value.",";
						else
							$grid_js .= $index.": '".$value."',";
				}
			}
		}
		
		$grid_js .= "colModel : [";
		
		//Get colModel
		foreach ($colModel as $index => $value) {
			$grid_js .= "{display: '".$value[0]."', ".($value[2] ? "name : '".$index."', sortable: true," : "")." width : ".$value[1].", align: '".$value[3]."'".(isset($value[5]) && $value[5] ? ", hide : true" : "")."},";  
			
			//If item is searchable
			if ($value[4] != 0)
			{
				//Start searchitems var
				if (!isset($searchitems))
					$searchitems = "searchitems : [";
					
				if ($value[4] == 2)
					$searchitems .= "{display: '".$value[0]."', name : '".$index."', isdefault: true},";
				else if ($value[4] == 1)
					$searchitems .= "{display: '".$value[0]."', name : '".$index."'},";
			}
				
		}
		//Remove the last ","
		$grid_js = substr($grid_js,0,-1).'],';
		$searchitems = substr($searchitems,0,-1).']';
		
		//Add searchitems to grid
		$grid_js .= $searchitems;

		//Get buttons
		
		if (is_array($buttons)) 
		{
			$grid_js .= ",buttons : [";
			foreach ($buttons as $index => $value) {
				if ($value[0] == 'separator')
					$grid_js .= "{separator: true},";
				else
					$grid_js .= "{name: '".$value[0]."', bclass : '".$value[1]."', onpress : ".$value[2]."},";
			}
			//Remove the last ","
			$grid_js = substr($grid_js,0,-1).']';
		} 
		
		//Finalize
		$grid_js .= "}); })</script>";
		
		return $grid_js;
	}
}

?>
ini controllernya:
<?php
	
	class Product extends CI_Controller{
		
		function __construct()
		{
			parent::__construct();
			
			//$this->load->helper('flexigrid');
			$this->load->model('product_model');
		}

		public function index()
		{	
					
			$this->lists();	
			
			 //$records = $this->Product_Model->get_master_flexigrid();			
			 // foreach($records as $row)
			 // {
				// echo $row;	
			 // }
		}
		
		public function lists() 
		{
			$site_url = site_url();
			$colModel['products.code'] = array('Code',70,TRUE,'center',2);
			$colModel['products.name'] = array('Name',200,TRUE,'left',2);
			$colModel['merk'] = array('Merk',100,TRUE,'left',2);
			$colModel['category'] = array('Category',100,TRUE,'left',2);
            $colModel['subcategory'] = array('SubCategory',100,TRUE,'left',2);
			$colModel['size'] = array('Size',70,TRUE,'center',2);
			$colModel['color'] = array('Color',80,TRUE,'center',2);
			$colModel['unit'] = array('Unit',50,TRUE,'center',2);
			$colModel['price'] = array('Sell Price',50,TRUE,'right',2);
			$colModel['weight'] = array('Weight',50,TRUE,'right',2);
			$colModel['picture'] = array('Picture',200,TRUE,'right',2);
			
	
			$gridParams = array(
				'width' => '100%',
				'height' => 300,
				'rp' => 15,
				'rpOptions' => '[10,15,20,25,30,40]',
				'pagestat' => 'Displaying: {from} to {to} of {total} items.',
				'blockOpacity' => 0.5,
				'title' => 'Products',
				'showTableToggleBtn' => true				
				);
			/*
			 * 0 - display name
			 * 1 - bclass
			 * 2 - onpress
			 */
						
			$buttons[] = array('Add','add','btn');			
			$buttons[] = array('separator');
			$buttons[] = array('Edit','edit','btn');			
			$buttons[] = array('separator');
			$buttons[] = array('Delete','delete','btn');
			$buttons[] = array('separator');
			$buttons[] = array('Select All','','btn');
			$buttons[] = array('DeSelect All','','btn');
			$buttons[] = array('separator');
			
			$grid_js = build_grid_js('flex1',site_url("product/load_data"),$colModel,'id','asc',$gridParams,$buttons);	
			$data['js_grid'] = $grid_js;				
			$data['content'] = $this->load->view('admin/catalog/product/list', $data, TRUE);						
			$data['grid'] = $this->Product_Model->getAll();			
			$data["title"] = "eYJProduct";			
			$this->load->view('admin/index');
			$this->load->view('admin/catalog/product/index', $data);

		}
		
		public function load_data() 
		{
			
			$this->load->library('flexigrid');
			
			$valid_fields = array('products.code','products.name','merk','category','subcategory', 'size_code','color','unit','price','weight','picture');
	
			
			$this->flexigrid->validate_post('products.name','ASC',$valid_fields);
			
			//$records = $this->master_brgmod->get_master_flexigrid();
			$records = $this->Product_Model->get_master_flexigrid();
			
		     
			$this->output->set_header($this->config->item('json_header'));
		
			$record_items = array();
		   	
			foreach ($records['records']->result() as $row)
			{
				$query = $this->Product_Model->getMasterById($row->code);
			echo $pic1=explode(";",$query['picture']); for($i=0;$i<count($pic1)-1;$i++){
						 $img=substr($pic1[$i],0,-4)."_small";$ext=substr($pic1[$i],-4);
						echo $image= "<img src='images/small/".$img.$ext."'>";}
					$record_items[] = array(
						$row->code,
						$row->code,
						$row->name,
						$row->merk,
						$row->category,
                        $row->subcategory,
						$row->size_code,
						$row->color,
						$row->unit,
						$row->price,
						$row->weight,
						$image
					);				
			}
			//Print please
			$this->output->set_output($this->flexigrid->json_build($records['record_count'],$record_items));
		}
?>
Mohon pencerahannya, tx.GBU

Lihat semua 15 jawaban

Silahkan login untuk menjawab!
mas, misal saya punya file index.html, di index.html saya buat 2 buah kotak.. yaitu kotak KIRI dan kotak KANAN.
Di kotak KIRI terdapat link HOME yg mengarah ke http://flashcobacoba.blogspot.com/p/lingkungan-hidup.html

nah bila link tersebut di klik, maka halaman http://flashcobacoba.blogspot.com/p/lingkungan-hidup.html munculnya ke kotak KANAN .. tanpa harus mereload semua tampilan index.html

gimana mas scriptnya?
mhon bantuan.. T.T

Lihat semua 3 jawaban

Silahkan login untuk menjawab!