Jump to content

fikiwan

Members
  • Posts

    60
  • Joined

  • Last visited

Posts posted by fikiwan

  1. I've seen data stored both ways. It's probably going to be a little faster if you store all of the data for a single user in one row rather than one field per row. It's also going to require more storage if you store one field per row, because you have to duplicate the field name for each user. But it's going to be more extendable or flexible if you have the second structure. One issue with having the second structure though is that you lose some of the power of indexes and constraints on the database. With the second structure you can't have the database enforce something like the name or email can't be blank, and you can't index certain fields (like email) to make them faster for lookups on that field. You can make both ID_MG and ID_UMG as a joint primary key in the second structure, and that will help some for speed, but the second structure is generally going to be slower. It's up to you whether you want to optimize your application to be more easily modified and extended, or faster. I typically use the first structure for things like users where the fields don't change much. If the list of fields might change frequently (which happens when you're storing certain objects in a database), then you might want to use the second structure for those objects. It would make sense to mix the two in a single application, where the objects whose fields don't change often use the first structure, and other things use the second.

    thanks for the explanation .
    I do thingking all day about it, so that i back here ..(ask more)
    if I want store many data user then KEY_MG will have many duplicate ,ya i thingking it not good for many data dummy in a field.. and i can give index in a field
    fewer field may be good but valid field it is the best..
    thanks much once again ..
    regards
  2. hello

     

    I thinking about wht is the best create many or just litle field in table a database :

     

    ex:

     

    I want create this :

    ----------------------------------------------------------------------------------------------------------------------------

    | ID_U | firsname | lastName | email | biograp | comment | status_res | activatio | aim | jabber |

    ----------------------------------------------------------------------------------------------------------------------------

    | 1 | fekke1 | laldjajdd | e@d.dcom | ndndn | blalalalal | a,ama | ,,,,,,,,, |....... | kakdd

    | 2 | dekj4 | jdhkhjdh | d@d.dcom |kskksk |blalalalal | a,amnka |,,,,,,,,,,, | ,,,,,,,,| ksjdhd

    |------------------------------------------------------------------------------------------------------------------------------

    you can look in above I create 10 field in my table ,

     

    Now I thingking only will make 4 field look ex below :

     

    --------------------------------------------------------

    | ID_MG | ID_UMG | KEY_MG | VALUE_KEY |

    --------------------------------------------------------

    | 1 | 1 | firsname | blalalalal |

    | 2 | 1 | lastName | blalalalal |

    | 3 | 1 | email | blalalalal |

    | 4 | 1 | biograp | blalalalal |

    | 5 | 1 | comment | blalalalal |

    | 6 | 1 | status_res | blalalalal |

    | 7 | 1 | activatio | blalalalal |

    | 8 | 1 | aim | blalalalal |

    | 9 | 1 | jabber | blalalalal |

    ---------------------------------------------------------

     

    you could look both example at above ,

    first table with many field and second just with 4 field ,

     

    now , in two way that, what the best way for on use database ..

     

    thanks for explain to me

     

    regards

     

  3. hello....
    I have file foto with name : my foto You.flv_snapshot_00.18_[2013.06.24_12.12.05].jpg
    I have do upload that foto ,
    the picture move to directori but not save in database....
    I think the problem lies name my picture ...
    .. How to rename foto be name valid more ..
    thnks Regards
    ...
  4. Hey ... :D I want display datetime from DB... EX : 2013-06-10 12:10:5 I want display only year = 2013 MONT = 06 day = 10 how to do like above display the part from datetime. thanks regards

  5. ya ... I'm back from there and now I'm ask for help something here ... (Y) it's not from DB , but just im tried like this

    <?phpecho "date('Y-m-d H:i:s A') ->". date('Y-m-d H:i:s A');?>

  6. We can select id like this

    if (isset($_GET['idvar'])){		$idvar = $_GET['idvar'];}else{	 echo"ID NOT DETECTION";}//QUERY DATA$q = "SELECT * FROM comments Where id = '$idvar'";

    <a href = exam.php?idvar=<?=$listid?> >Per ID  </a>   <!-- GET IDVAR FROM HERE -->

  7. <form action="insert.php" method="post">Username: <input type="text" name"Username" />Title: <input type="text" name"Title" size="30" />Content: <input type="text" name="Content" class="inputtext" /><input type="submit" /></form> <!--Add this u forget close tag -->

  8. KeyHot is a global variable. If you set the value of KeyHot[27] to true, it STAYS true until your script changes it. But you gain nothing by using an array in this case. if (charCode == 27) is the only test you should need.
    Thank for the help correct
  9. hello I make a hotkey for aplication Webpleas Chek my code...

    <!DOCTYPE html><html><head><meta http-equiv="X-UA-Compatible" content="IE=Edge" ><style type="text/css">body{background:green;}  #over{   background: rgba(0,0,0,0.8);   width: 100%;   height: 100%;   top: 0; bottom: 0;left: 0;right: 0;   border: 0px solid blue;   position: fixed;  }  #data{border:3px solid white; width: 300px; margin:100px auto;background: white; color:blue; font:2em 'Agency FB';text-align: center;}  a{cursor: pointer;}</style><script type="text/javascript">window.onload = dokeyHot();   var KeyHot = [];   function dokeyHot () {    if (window.event) {	 document.captureEvents(event.KEYPRESS);    }    document.onkeydown = function(e){	 var charCode = (e.which) ? e.which : e.keyCode;	 KeyHot[charCode] = true;	 if (KeyHot[27]) { // ESC Button	  document.getElementById("box").innerHTML = "";	 }    }   }   function tekan () {    var dawal = "<div id='over'>";    var dakhir = "</div>";    var data = "<div id='data'>Pleas Turn Button ESC</div>"    document.getElementById("box").innerHTML=dawal+data+dakhir;   }</script></head><body><div id="box"></div><button onclick="tekan();">Tekan</button></body><html>

    if press button tekan will display a dialogbox and if press ESC in keyboard dialogbox will lost but that just run very well just for first time.. if I press again tekan dialogbox will lost with all button in keyboard ... ??? I want dialogbox lost just if press button ESC keyboard.. thnks for correct

  10. Hey .. I do multiple UPdate Data Like this but its still not work ,if I just do update for single tabel no problem its all run very well , what wrong with below code Thanks

    /*============ Koneksi To DB===========*///require_once'../../../inc/koneksi.php';/*============== Variabel Data Siswa================*/   $id = $_POST['id_user'];  $nama = $_POST['nama']; $lahir = $_POST['tempat_lahir'];  /*-------- Variabel untuk TBT-------------*///$tgl = $_POST['tgl'];  $bulan = $_POST['bulan'];   $tahun = $_POST['tahun'];   $tbt = $_POST['tahun']."-".$_POST['bulan']."-".$_POST['tgl']; $agama = $_POST['agama'];$jenkel = $_POST['kelamin'];$nm_ortu = $_POST['nm_ortu'];$alamat = $_POST['alamat'];/*================ Variabel Lokal===========*/  $phobi = $_POST['phobi'];     $cita = $_POST['cita'];$goll = $_POST['goll'];//Query Update Data$q = "UPDATE duser SET id_user='$id',nama='$nama',tempat_lahir='$lahir',tgl_lahir='$tbt',agama='$agama',jenkel='$jenkel',nm_ortu='$nm_ortu',alamat='$alamat' WHERE id_user ='$id'; UPDATE extrarull SET id_ex='$id',phobi='$phobi',cita='$cita',goll='$goll' WHERE id_ex = $id'";if ($dq = mysql_query($q)) {info_sukses("Sukses Update");}else{info_gagal("Gagal Update ");}  

    This is example of DBso here I want change data for id_user (1001) at 2 table below so I do like above but is it still not run .. but if ijust do single update like this:

    //Query Update Data$q = "UPDATE duserSET id_user='$id',nama='$nama',tempat_lahir='$lahir',tgl_lahir='$tbt',agama='$agama',jenkel='$jenkel',nm_ortu='$nm_ortu',alamat='$alamat' WHERE id_user ='$id'";if ($dq = mysql_query($q)) {info_sukses("Sukses Update");}else{info_gagal("Gagal Update ");}

    all work very wellEX : Table duser+---------+--------+----------+---------------------+------------------+----------+------------- +------------------------------+| id_user | nama | tempat_lahir | tgl_lahir | agama | jenkel | nm_ortu | alamat |+---------+--------+----------+---------------------+-------------------+---------+------------- +------------------------------| 1001 | Anton | Padang Pas | 2001-11-12 | samawi | L | Jono w | Jl.tutun naik ptang no90 || 1020 | Alex | Jalan Lama | 1990-10-12 | duniawi | L | Bobo K | Jln majujalan no 99 |+---------+--------+----------+---------------------+-------------------+----------+-------------+----------------------------- EX : Table extrarull+---------+------------+--------------+---------------------+| id_ex | phobi | cita | goll |+---------+------------+--------------+---------------------+| 1001 | Lalok | pragamer | masih di utak | | 1020 | batang | developer | Baru sdangjalan | +---------+-----------+---------------+---------------------+ Thank for helpful

×
×
  • Create New...