mengurutkan id

erick · Dec 18, 2012
bli mau nanyak,,gmn codingnya agar fiel (id) yg sdh d hapus bisa berurutan kembali..?

Lihat semua 1 jawaban

Silahkan login untuk menjawab!
Permisi suhu..
Mau bertanya lagi nih..
Ini potongan scriptnya..
$where = "";
$tgl_awal = $_GET['tgl_awal'];
$tgl_akhir = $_GET['tgl_akhir'];
$nama = $_GET['keyw'];

If(!isset($tgl_awal)&&!isset($tgl_akhir)&&!isset($nama)){
	
		$where .="";}
	elseif(!isset($nama)){
		$where .= " WHERE tanggal BETWEEN '".$tgl_awal."' AND '".$tgl_akhir."' ";}
	elseif(!isset($tgl_awal)&&!isset($tgl_akhir)){
		$where .= " WHERE nama LIKE '%".$nama."%' ";}

$result = mysql_query("SELECT * FROM absen ".$where."ORDER BY log_absen DESC") or die('Query failed!');

Hasil yang keluar selalu SELECT * FROM Absen ORDER BY log_absen DESC..
Meskipun saya memcoba berbagai cara untuk bisa masuk ke kondisi 1 atau 2, tetap saja hasil dari $where itu = " "..
Kira2 ada yang salah g dari codingan gw?

Terima kasih atas bantuannya..

Lihat semua 5 jawaban

Silahkan login untuk menjawab!
Aku bikin suatu scrip dmna scrip itu terdapat cekbox yang di ulang dengan nama cekboxa yg berbeda,dan di script yg ke dua aku menampilkannya...tp knapa yg muncul hanya value dari cekbox yang paling terakhir...mhon bantuannya.....
index.php
<?php
session_start();
$date=date("Y-m-d");

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Equity Indonesia</title>
<link rel="stylesheet" type="text/css" href="css/accordion_glam.css" />
<link rel="stylesheet" type="text/css" href="css/style3.css" />

<style type="text/css">
<!--
.style1 {font-size: 10px}
-->
</style>
</head>
<body>
 <div id="header">
 <div class="shell"><div class="logo"> <img src="images/Logo-Equity.png" align="left" height="95"/></div>
 <div class="right_header"></div>
 </div></div>
<br />

<div id="main_container">
  <div class="main_content">
    
                   <br />  <br /> 
      <div class="center_content">
        <div class="right_content">
        
        
        <?php 
		include "main_function.php";
		$sqlpesan = mysql_query("select * from tb_pesan");
		$no = mysql_num_rows($sqlpesan);
		?>
        <table width="1057" id="rounded-corner-notgl">
        <tr>
          <td width="28" height="33" align="left" valign="middle"><h2>No </h2></td>
          <td width="10" align="right" valign="middle"><h2>: </h2></td>
          <td width="375" align="left" valign="middle"><h2><?php echo $no+1; ?> </h2></td>
          <td width="2" valign="middle">&nbsp;</td>
          <td width="583" align="right" valign="middle"><h2>Tanggal </h2> </td>
          <td width="10" align="right" valign="middle"><h2>: </h2></td>
          <td width="17" align="left" valign="middle"><h2><?php echo $date; ?> </h2></td>
        </table>
        
        <?php
		
		include "main_function_formbec.php";
		$sqlmember = mysql_query("select * from tb_member where ID_member = '".$_SESSION['ID_member']."'");
		$member = mysql_fetch_array($sqlmember);
		?>
          <table width="850px" height="49" id="rounded-corner-top">
            <thead>
              <tr>
              <th width="850" height="16" align="center" valign="top">
              <table width="476"  id="rounded-corner">
                <tr>
                  <th width="123">Member ID</td>
                  <th width="19" align="left">:</td>
                  <td width="318"><?php echo $_SESSION['ID_member']; ?></td>
                </tr>
                <tr>
                  <th>Member
                  <th align="left">:
                    </th>
                  <td><?php echo $member['nama_member']; ?></td>
                </tr>
              </table></th>
              <th align="center" valign="top"><table  id="rounded-corner">
                <tr>
                  <th width="99">No Tlpn
                  <th width="26" align="left">:</td>
                  <td width="284"><?php echo $member['notlpn']; ?></td>
                </tr>
                <tr>
                  <th>Alamat
                  <th align="left">:
                    </td>
                  <td><?php echo $member['alamat']; ?></td>
                </tr>
                
              </table></th>
            </tr></thead>
            <tbody></tbody>
          </table>
          <br />
          <?php 
include "main_function.php";
?>
          <form name="filter" action="?" method="get"><table id="rounded-corner-top" width="1057">
            <tr>
          <td width="35">Pusat</td>
          <td width="2">:</td>
          <td width="180"><input type="text" name="pusat" value="<?php if (isset($_GET['pusat'])){ echo $_GET['pusat']; }else{} ?>"/></td>
          <td width="66">Cabang</td>
          <td width="2">:</td>
          <td width="185"><input type="text" name="cabang" value="<?php if (isset($_GET['cabang'])){ echo $_GET['cabang']; }else{} ?>" /></td>
       	  <td width="81">Distributor</td>
       	  <td width="8">:</td>
       	  <td width="178"><input type="text" name="distributor" value="<?php if (isset($_GET['distributor'])){ echo $_GET['distributor']; }else{} ?>" /></td>
          <td width="77"><input type="submit" value="Filter" /></td>
          </tr></table></form>
         <br />
          <table width="1057" height="8" bgcolor="#666666">
          <tr><td width="1053" height="2"></td>
          </tr></table>
          <br />
          <a href="?all=yes">Load..</a>
          <form action="proses.php" name="usertest" method="post">
          <table width="1057" id="rounded-corner-buttom">
            <tr>
              <th width="41" align="center" valign="middle">Pilih</th>
          <th width="216">Test ID</th>
          <th width="180">Nama</th>
          <th width="31" align="center" valign="middle">JK</th>
          <th width="205">No Tlpn</th>
          <th width="257">Alamat</th>
          <th width="95" align="center" valign="middle">Tanggal Test</th>
          </tr>
          <?php
		  $pusat = $_GET['pusat'];
		  $cabang = $_GET['cabang'];
		  $distributor = $_GET['distributor'];
		  
		  if(isset($_GET['pusat']) || isset($_GET['cabang']) || isset($_GET['distributor']))
		  {
		  $i=1;
		  $sql = mysql_query("select * from tb_usertest  where  pusat = '".$pusat."' and cabang = '".$cabang."' and distributor = '".$distributor."' order by tgl_test DESC");
		  while($data = mysql_fetch_array($sql))
		  {
          ?><tr>
            <td align="center" valign="middle"><input type="checkbox" name="A<?php echo $data['ID_test']; ?>" value="<?php echo $data['ID_test']; ?>" /></td>
            <td align="left" valign="middle"><?php echo $data['ID_test']; ?></td>
           <td align="left" valign="middle"><?php echo $data['nama']; ?></td>
            <td align="center" valign="middle"><?php echo $data['jenis_kelamin']; ?></td> 
            <td align="left" valign="middle"><?php echo $data['notlpn']; ?></td> 
          <td align="left" valign="middle"><?php echo $data['alamat']; ?></td>
            <td align="center" valign="middle"><?php echo $data['tgl_test']; ?></td>
          </tr><?php 
		  $i++;
		  ?><input type="hidden" name="n" value="<?php echo $i; ?>"/>
          <input type="hidden" name="ID_test" value="<?php echo $data['ID_test']; ?>"/>
		  <?php
		  } 
		  
		  }
		  else
		  {
		  $i=1;
		  $sql = mysql_query("select * from tb_usertest order by tgl_test DESC");
		  while($data = mysql_fetch_array($sql))
		  {
          ?><tr>
            <td align="center" valign="middle"><input type="checkbox" name="A<?php echo $data['ID_test']; ?>"  value="<?php echo $data['ID_test']; ?>"/></td>
            <td align="left" valign="middle"><?php echo $data['ID_test']; ?></td>
           <td align="left" valign="middle"><?php echo $data['nama']; ?></td>
            <td align="center" valign="middle"><?php echo $data['jenis_kelamin']; ?></td> 
            <td align="left" valign="middle"><?php echo $data['notlpn']; ?></td> 
          <td align="left" valign="middle"><?php echo $data['alamat']; ?></td>
            <td align="center" valign="middle"><?php echo $data['tgl_test']; ?></td>
          </tr><?php 
		  $i++;
		  ?>
          <input type="hidden" name="n" value="<?php echo $i; ?>"/>
          <input type="hidden" name="ID_test" value="<?php echo $data['ID_test']; ?>"/>
		  
		  
		  <?php
		  } 
		  
		  }
		  ?></table>
          
          <input name="ok" type="submit" value="OK" class="buttonbt_blue">
          </form>
          <h2></h2>
     </div>
    <!-- end of right content-->
            
                    
  </div>   <!--end of center content -->               
                    
                    
    
    
    <div class="clear"></div>
</div> <!--end of main content-->
	
    
  <div class="footer"></div>
</div>		
</body>

<br />
</html>
proses.php

<?php
session_start();

include "main_function.php";

//$nmcb = "A".$_POST["ID_test"];
$n= $_POST['n'];


$date=date("Y-m-d");


?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Equity Indonesia</title>
<link rel="stylesheet" type="text/css" href="css/accordion_glam.css" />
<link rel="stylesheet" type="text/css" href="css/style3.css" />

<style type="text/css">
<!--
.style1 {font-size: 10px}
-->
</style>
</head>
<body>
 <div id="header">
 <div class="shell"><div class="logo"> <img src="images/Logo-Equity.png" align="left" height="95"/></div>
 <div class="right_header"></div>
 </div></div>
<br />

<div id="main_container">
  <div class="main_content">
    
                   <br />  <br /> 
      <div class="center_content">
        <div class="right_content">
          <form action="proses.php" name="usertest" method="post">
          <table width="1057" id="rounded-corner-buttom">
            <tr>
          <th width="216">Test ID</th>
          <th width="180">Nama</th>
          <th width="31" align="center" valign="middle">JK</th>
          <th width="205">No Tlpn</th>
          <th width="257">Alamat</th>
          <th width="95" align="center" valign="middle">Tanggal Test</th>
          </tr>
          <?php
		  $nmcb = "A".$_POST['ID_test'];
		  $ID = $_POST[$nmcb];
		   $sql = mysql_query("select * from tb_usertest where ID_test = '".$ID."' order by tgl_test DESC");
		  while($data = mysql_fetch_array($sql))
		  {
          ?><tr>
            <td align="left" valign="middle"><?php echo $data['ID_test']; ?></td>
           <td align="left" valign="middle"><?php echo $data['nama']; ?></td>
            <td align="center" valign="middle"><?php echo $data['jenis_kelamin']; ?></td> 
            <td align="left" valign="middle"><?php echo $data['notlpn']; ?></td> 
          <td align="left" valign="middle"><?php echo $data['alamat']; ?></td>
            <td align="center" valign="middle"><?php echo $data['tgl_test']; ?></td>
          </tr><?php 
		  }
		  ?></table>
          
          </form>
          <h2></h2>
     </div>
    <!-- end of right content-->
            
                    
  </div>   <!--end of center content -->               
                    
                    
    
    
    <div class="clear"></div>
</div> <!--end of main content-->
	
    
  <div class="footer"></div>
</div>		
</body>

<br />
</html>

Lihat semua 1 jawaban

Silahkan login untuk menjawab!
para master sekalian,,,saya mau minta tolong,,,saya lagi latihan bikin program penjualan make php,,dan saya punya masalah yitu cara menampilkan harga pada textbox otomatis ketika jenis barang di combobox di klik pada php itu gmana scriptny y?

Lihat semua 1 jawaban

Silahkan login untuk menjawab!

ujian try out offline

dpatoy · Dec 15, 2012
pada aplikasi to aku baru bisa menampilkan semua soal/ 40 soal pada 1 halaman dengan soal random mas dan pertanyaan nya baru berbentuk teks, saya udah coba mngunakan ckfinder dan ckeditor untuk inputin soal gambar.
pengennya nampilin soal 1 halaman 1 soal dan soal bisa berbentuk gambar dan suara.
pada soal bhs inggris ada listening mas 15 soal.
Help mas.. udh searching kemana2 gak ketemu2.:(

Lihat semua 3 jawaban

Silahkan login untuk menjawab!
mas aku punya file php buat insert tapi menggunakan select statements, yaitu seperti ini
<?php

  mysql_connect("localhost", "root", "");
  mysql_select_db("combo");
  

  $produk     		= htmlspecialchars($_POST['produk']);
  $unit				= htmlspecialchars($_POST['unit']);
  $lama				= htmlspecialchars($_POST['lama']);

 

  $sql            = "insert into air (produk,unit) select produk.nama, unit_mk.unit from produk INNER JOIN unit_mk ON produk.id = unit_mk.id_mk and $produk = produk.id";


	
  mysql_query($sql) or die ('failed');
             
  echo  "<h1>Register Success</h1>";
  echo  "<br>";
  

 
  
?>     

nah tapi aku bingung, masukin harga lama dalam hal ini $lama bagimana bentuk perintahnya

terima kasih

Lihat semua 1 jawaban

Silahkan login untuk menjawab!