Sensasi dalam dunia Forex! Cepat dapatkan tawaran terbaru daripada InstaForex - bonus 45% untuk setiap deposit! Bonus 45% untuk keuntungan yang maksimum!


     
All banners are advertisements only. CG does not endorse or vouch for any advertisers. Read Disclaimer HERE


Go Back   CariGold Forum > COMPUTER, TECHNOLOGY, INTERNET & COMMUNICATIONS > Webmaster, Blogger Discussion > Programming, Web Development

CG Sponsors



Recommended Brokers

CG Updates
0 Forum rules improvised
Last Post: CariGold
Posted On: 05-02-2014
Replies: 0
Views: 23,185
0 Social Group is now based on request
Last Post: CariGold
Posted On: 11-12-2012
Replies: 0
Views: 53,788
0 Unscheduled maintenance
Last Post: CariGold
Posted On: 26-11-2012
Replies: 0
Views: 41,219
More...
Reply
 
Thread Tools
  #11  
Old 27-07-2012, 03:06 PM
Megat Sri Rama Megat Sri Rama is offline
CG Top Poster Club

Megat Sri Rama's Avatar
 
Trader Rating: (2)
Join Date: Aug 2007
Posts: 20,244
Poster Rank: #87
Thanked 487 Times
Active Level
Default

Bos... buat la tutorial Design Pattern (dengan konteks PHP)....
__________________
Saya benci Mahathir Bin Mohamad Kutty
Reply With Quote
Paid Advertisement
  #12  
Old 27-07-2012, 10:36 PM
dinxq dinxq is offline
Active Member

 
Trader Rating: (21)
Join Date: Jul 2009
Posts: 1,209
Poster Rank: #3029
Blog Entries: 3
Thanked 1 Time
Active Level
Default

Quote:
Originally Posted by Megat Sri Rama View Post
Bos... buat la tutorial Design Pattern (dengan konteks PHP)....
Nak buat game ka?
__________________
Reply With Quote
  #13  
Old 29-07-2012, 09:26 PM
Megat Sri Rama Megat Sri Rama is offline
CG Top Poster Club

Megat Sri Rama's Avatar
 
Trader Rating: (2)
Join Date: Aug 2007
Posts: 20,244
Poster Rank: #87
Thanked 487 Times
Active Level
Default

Quote:
Originally Posted by dinxq View Post
Nak buat game ka?
takde la....

it's just that kalau nak produktif dalam PHP, extending popular projects or working with frameworks, tak boleh lari dari design pattern.

paling tidak akan jumpa MVC dan Factory pattern.

Kalau tak faham pattern, memang pening la nak faham kod orang.
__________________
Saya benci Mahathir Bin Mohamad Kutty
Reply With Quote
  #14  
Old 30-07-2012, 02:59 AM
ismaildani ismaildani is offline
Junior Member

 
Trader Rating: (0)
Join Date: Sep 2011
Posts: 64
Poster Rank: #17264
Thanked 0 Times
Active Level
Exclamation sapa otai PHP programer kat sini..mintak tolong..plz

as salam otai2..
sy ada pertanyaan tentang coding php..
sy ada develop satu database phpmysql untuk portal..pengguna daftar dekat form and bile data tu dah submit secara automatik ianya telah masuk ke dalam database..
Yang menjadi masalah nye kenape bile nk daftar untuk pengguna baru, field utk daftar tu die recall balik data yang ada dekat database..kenapa form tu die tk kosong "blank form" tekan reset button pon sama jugak..form tu dah brfunction utk recall data tu balik dari database..ada sapa yg terer pasal php programming la tlg jelaskan pada sy..a.s.a.p


coding spt dibawah:
<?php require_once('Connections/pendaftaran.php'); ?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;

switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
**
return $theValue;
**

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
**

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO profil (nama, ic, kursus, jantina, umur, alamat, status) VALUES (%s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['nama'], "text"),
GetSQLValueString($_POST['ic'], "text"),
GetSQLValueString($_POST['kursus'], "text"),
GetSQLValueString($_POST['jantina'], "text"),
GetSQLValueString($_POST['umur'], "text"),
GetSQLValueString($_POST['alamat'], "text"),
GetSQLValueString($_POST['status'], "text"));

mysql_select_db($database_pendaftaran, $pendaftaran);
$Result1 = mysql_query($insertSQL, $pendaftaran) or die(mysql_error());

$insertGoTo = "index.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
**
header(sprintf("Location: %s", $insertGoTo));
**

mysql_select_db($database_pendaftaran, $pendaftaran);
$query_rsdaftar = "SELECT profil.id_profil, profil.nama, profil.ic, profil.no_matriks, profil.kursus, profil.jantina, profil.umur, profil.email, profil.no_tel, profil.no_telefon, profil.alamat, profil.status FROM profil";
$rsdaftar = mysql_query($query_rsdaftar, $pendaftaran) or die(mysql_error());
$row_rsdaftar = mysql_fetch_assoc($rsdaftar);
$totalRows_rsdaftar = mysql_num_rows($rsdaftar);
?><!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=iso-8859-1" />
<title>pendaftaran pelajar</title>
</head>

<body>
<p align="center">Pendaftaran Pelajar</p>
<form action="<?php echo $editFormAction; ?>" id="form1" name="form1" method="POST">
<p align="center">Maklumat Pelajar : </p>
<table width="760" border="1" align="center">
<tr>
<td width="147">Nama : </td>
<td width="597"><label>
<input name="nama" type="text" id="nama" value="<?php echo $row_rsdaftar['nama']; ?>" size="50" />
</label></td>
</tr>
<tr>
<td>No kad pengenalan : </td>
<td><label>
<input name="ic" type="text" id="ic" value="<?php echo $row_rsdaftar['ic']; ?>" size="30" />
eg :890328015183 </label></td>
</tr>
<tr>
<td>No kad matriks : </td>
<td><label>
<input name="matriks" type="text" id="matriks" value="<?php echo $row_rsdaftar['no_matriks']; ?>" />
</label></td>
</tr>
<tr>
<td>Kursus : </td>
<td><label>
<select name="kursus" size="1" id="kursus" title="<?php echo $row_rsdaftar['kursus']; ?>">
<option>IT</option>
<option>KM</option>
<option>KA</option>
<option>KE</option>
</select>
</label></td>
</tr>
<tr>
<td>Jantina : </td>
<td><label>
<select name="jantina" id="jantina" title="<?php echo $row_rsdaftar['jantina']; ?>">
<option>LELAKI</option>
<option>PEREMPUAN</option>
</select>
</label></td>
</tr>
<tr>
<td>Umur : </td>
<td><label>
<input name="umur" type="text" id="umur" value="<?php echo $row_rsdaftar['umur']; ?>" />
</label></td>
</tr>
<tr>
<td>Email : </td>
<td><label>
<input name="emai" type="text" id="emai" value="<?php echo $row_rsdaftar['email']; ?>" size="40" />
</label></td>
</tr>
<tr>
<td>No telefon (H) : </td>
<td><label>
<select name="notel" id="notel" title="<?php echo $row_rsdaftar['no_tel']; ?>">
<option>010</option>
<option>012</option>
<option>013</option>
<option>014</option>
<option>016</option>
<option>017</option>
<option>018</option>
<option>019</option>
</select>
<input name="notelefon" type="text" id="notelefon" value="<?php echo $row_rsdaftar['no_telefon']; ?>" />
</label></td>
</tr>
<tr>
<td>Alamat : </td>
<td><label>
<textarea name="alamat" cols="30" rows="3" id="alamat"><?php echo $row_rsdaftar['alamat']; ?></textarea>
</label></td>
</tr>
<tr>
<td>0Status : </td>
<td><label>
<select name="status" id="status" title="<?php echo $row_rsdaftar['status']; ?>">
<option>BUJANG</option>
<option>BERKAHWIN</option>
</select>
</label></td>
</tr>
</table>
<p align="center">Maklumat Sistem :</p>
<table width="758" border="1" align="center">
<tr>
<td width="157">ID pengguna : </td>
<td width="585"><label>
<input name="textfield7" type="text" />
</label></td>
</tr>
<tr>
<td height="25">Kata laluan : </td>
<td><label>
<input name="textfield8" type="password" />
</label></td>
</tr>
<tr>
<td>Confirm kata laluan : </td>
<td><label>
<input name="textfield9" type="password" />
</label></td>
</tr>
</table>
<p align="center">
<label>
<input type="submit" name="Submit" value="Submit" />
</label>
<label>
<input name="reset" type="reset" id="reset" value="Reset " />
</label>
</p>



<input type="hidden" name="MM_insert" value="form1">
</form>
<p align="center">&nbsp;</p>
<p>&nbsp; </p>
</body>
</html>
<?php
mysql_free_result($rsdaftar);
?>
Reply With Quote
  #15  
Old 30-07-2012, 09:39 AM
erro_sennin erro_sennin is offline
Active Member

erro_sennin's Avatar
 
Trader Rating: (3)
Join Date: May 2010
Location: in the parallel universe
Posts: 785
Poster Rank: #4193
Thanked 43 Times
Active Level
Default

ok bro, nice idea, nti aku update ttg MVC pattern.

Quote:
Originally Posted by Megat Sri Rama View Post
Bos... buat la tutorial Design Pattern (dengan konteks PHP)....
Reply With Quote
  #16  
Old 30-07-2012, 09:45 AM
erro_sennin erro_sennin is offline
Active Member

erro_sennin's Avatar
 
Trader Rating: (3)
Join Date: May 2010
Location: in the parallel universe
Posts: 785
Poster Rank: #4193
Thanked 43 Times
Active Level
Default

Bro dh buat select query dn paparkan data dekat form, sbb itu
form display kan data.


Quote:
Originally Posted by ismaildani View Post
as salam otai2..
sy ada pertanyaan tentang coding php..
sy ada develop satu database phpmysql untuk portal..pengguna daftar dekat form and bile data tu dah submit secara automatik ianya telah masuk ke dalam database..
Yang menjadi masalah nye kenape bile nk daftar untuk pengguna baru, field utk daftar tu die recall balik data yang ada dekat database..kenapa form tu die tk kosong "blank form" tekan reset button pon sama jugak..form tu dah brfunction utk recall data tu balik dari database..ada sapa yg terer pasal php programming la tlg jelaskan pada sy..a.s.a.p
Reply With Quote
  #17  
Old 30-07-2012, 10:48 AM
ikyxx ikyxx is offline
Junior Member

 
Trader Rating: (0)
Join Date: Jul 2012
Posts: 63
Poster Rank: #17367
Thanked 0 Times
Active Level
Default

fuhh. php. da lame tinggal. last time gne Zend framework.
Reply With Quote
  #18  
Old 30-07-2012, 03:41 PM
ismaildani ismaildani is offline
Junior Member

 
Trader Rating: (0)
Join Date: Sep 2011
Posts: 64
Poster Rank: #17264
Thanked 0 Times
Active Level
Default

Quote:
Originally Posted by erro_sennin View Post
Bro dh buat select query dn paparkan data dekat form, sbb itu
form display kan data.
yeke..abis tu nk pilih ape ek dkat prnyataan SQL tuh..??
Reply With Quote
  #19  
Old 31-07-2012, 12:50 AM
Lancelot Lancelot is offline
Well-Known
Member

Lancelot's Avatar
 
Trader Rating: (0)
Join Date: Jan 2010
Posts: 6,448
Poster Rank: #561
Thanked 8 Times
Active Level
My Mood:
Default

Quote:
Originally Posted by ismaildani View Post
yeke..abis tu nk pilih ape ek dkat prnyataan SQL tuh..??
ni biar aku tolong, takdela hebat , tapi ada la sikit ilmu di dada

actually form yang bro buat tu every time dia load, dia akan display data dalam form kan .

itu bermaksud bro dah letak sql statement dalam page yang sama. better kalau bro jangan letak sql statement tu dalam page form masukkan data tu.

buat satu page kosong yang page form tu akan redirect ke page kosong tu dan dalam page kosong tu letakkan koding sql untuk insert data .

apabila selesai insert data redirect balik page kosong tu ke page yang lain (contohnya page notification). so masalah data akan di displaykan dalam form tu takkan berlaku lagi

so kronologi perjalanan proses tu
1. masukkan data
2. tekan submit
3. redirect ke page kosong(empty) dan berlaku proses insert data
4. dari page kosong tu akan redirect ke page seterusnya (contoh notification page)

and ingin diberitahu yang bro takkan nampak page kosong tu sebab bila bro tekan submit, pertukaran page dari page form -> notification page berlaku dengan cepat . page kosong tu sekadar controller je untuk bro letakkan sql insert code
Reply With Quote
  #20  
Old 31-07-2012, 04:13 PM
ismaildani ismaildani is offline
Junior Member

 
Trader Rating: (0)
Join Date: Sep 2011
Posts: 64
Poster Rank: #17264
Thanked 0 Times
Active Level
Smile

Quote:
Originally Posted by Lancelot View Post
ni biar aku tolong, takdela hebat , tapi ada la sikit ilmu di dada

actually form yang bro buat tu every time dia load, dia akan display data dalam form kan .

itu bermaksud bro dah letak sql statement dalam page yang sama. better kalau bro jangan letak sql statement tu dalam page form masukkan data tu.

buat satu page kosong yang page form tu akan redirect ke page kosong tu dan dalam page kosong tu letakkan koding sql untuk insert data .

apabila selesai insert data redirect balik page kosong tu ke page yang lain (contohnya page notification). so masalah data akan di displaykan dalam form tu takkan berlaku lagi

so kronologi perjalanan proses tu
1. masukkan data
2. tekan submit
3. redirect ke page kosong(empty) dan berlaku proses insert data
4. dari page kosong tu akan redirect ke page seterusnya (contoh notification page)

and ingin diberitahu yang bro takkan nampak page kosong tu sebab bila bro tekan submit, pertukaran page dari page form -> notification page berlaku dengan cepat . page kosong tu sekadar controller je untuk bro letakkan sql insert code
btw terima kasih otai2..
betul gak tu tuan,,tp saya dah jumpe cara lain..pernyataan SQL mesti SELECT dan WHERE..so masalah form ni da selesai..pada pendapat sy klau satu page pon tkpe..tp klau tknk pening kepala dan utk aspek kekemasan kod..buat page berasingan..
Reply With Quote
Sponsored Links
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +8. The time now is 06:13 PM.


Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Disclaimer : All posts made by either members or mods even admins on CariGold.com are just only individual opinions, not necessarily or specifically those of CariGold.com or it's owner. CariGold does neither support, endorse nor vouch any programs and/or opportunities discussed here. We also does not give/offer investment advice and we does not research the opportunities discussed here. We simply provide a place for discussion. YOU'RE ON YOUR OWN RESPONSIBILITY IF YOU LOSE SUM OF MONEY IN ANY PROGRAMS DISCUSSED HERE