CariDotMy

 Forgot password?
 Register

ADVERTISEMENT

View: 2887|Reply: 12

PHP programing

[Copy link]
Post time 31-10-2008 03:23 PM | Show all posts |Read mode
alo kawan2...

ni nk tanya..kalau dalam databese tu kite set id sebagai primary key...
then dalam databese dah de contoh id=1234
then dalam form masukan id=1234
then kuar warning ckp dalam database dah de id tu...so nk wat cmne erk nk suh kuar warning ckp dlm data base xmsk n dah de id tu..??
Reply

Use magic Report


ADVERTISEMENT


Post time 31-10-2008 03:41 PM | Show all posts
xder dak open source ke sini... ermm.. tolong lah kami..  data reader dlm php cam nerr... pastuh assign dlm class .. ado.net dlm php cam nerkk.. xleh tolong... aku zero php... help kitorang.. kitorangg bdk baru ajarrr......  
Reply

Use magic Report

Post time 31-10-2008 08:27 PM | Show all posts

Reply #1 cloud_hardcore's post

konsepnya sama macam login...

kuar warning masa exception
Reply

Use magic Report

 Author| Post time 31-10-2008 10:32 PM | Show all posts
urmmm...
aku tye bdk2 ni sume ajar gne wizard dreamweaver...
so klu nk bace coding dreamweaver tu mmg xphm la..
cube ko paste coding proses login n form login...
nnt aku paham kan konsep tu..
Reply

Use magic Report

Post time 1-11-2008 09:59 AM | Show all posts
2 cara..

1.
$sql = "INSER INTO table (id) VALUES (". $_POST['id'] .")";
if(!$query = mysql_query($sql))
{
  echo mysql_error();
}

2. validate dulu id tu.......
$sql = "SELECT FROM table WHERE id = ". $_POST['id'];
$query = mysql_query($sql);
if($row = mysql_fetch_assoc($query)
{
  echo "Error, duplicate ID";
}
else
{
  "insert data";
}
Reply

Use magic Report

 Author| Post time 4-11-2008 02:00 PM | Show all posts

Reply #5 BorderManager's post

nape aku buat tak jadi erk ??
Reply

Use magic Report

Follow Us
Post time 4-11-2008 03:00 PM | Show all posts
mungkin sbb ko copy + paste = save as .php
Reply

Use magic Report

Post time 4-11-2008 05:13 PM | Show all posts
jgn la copy bulat2.... baca & faham la dulu. aku main taip je. aku pun tak test jln ke tak...
Reply

Use magic Report


ADVERTISEMENT


Post time 5-11-2008 01:55 PM | Show all posts
mungkin xderr connectionn db, <br/>databasee x buat lagi.... <br/>mungkin member ko ajar x habisss....   php tuh aperr arr...... lupaaa arr...:@
Reply

Use magic Report

Post time 9-11-2008 08:43 AM | Show all posts
cuber kau paste jer kat sini coding kau..
pastu bagitahu sekali..
pastu bagitahu aper yang xjadi..
kalau ader error paste error..
Reply

Use magic Report

Post time 17-12-2008 03:32 PM | Show all posts
maybe ko bleh try cara nie

$sql    = "SELECT * FROM table WHERE idMember=$_POST['id']";
$result    = mysql_query($sql)or die('Connection failure');   
if($row = mysql_fetch_assoc($result)){
    if ($row['idMember'] == ' ') {
        $sqlInsert    = "INSERT INTO table VALUES($id_member)";
        $rsInsert    = mysql_query($sqlInsert) or die('Comment cannot be added');
    }  
}else{
  **kat sini echo ape2 alert utk
    e.g : echo "Duplicate ID cannot insert new record";
}
Reply

Use magic Report

Post time 19-12-2008 06:26 PM | Show all posts
kalo pakai java script leh gak..
Reply

Use magic Report

Post time 19-12-2008 07:04 PM | Show all posts
ni yg aku wat....

<?php

require 'files/header.inc.php';
if ( !isset($_POST['nokp']) || !isset($_POST['pass']) || !isset($_POST['repass']) || !isset($_POST['email']) || !isset($_POST['nama']) || !isset($_POST['alamat']) ||!isset($_POST['poskod']) || !isset($_POST['bandar']) || !isset($_POST['kerja']) || !isset($_POST['jantina']) || $_POST['nokp'] == '' || $_POST['pass'] == '' || $_POST['repass'] == '' || $_POST['email'] == '' || $_POST['nama'] == '' || $_POST['alamat'] == '' || $_POST['poskod'] == '' ||  $_POST['bandar'] == '' || $_POST['kerja'] == '' ||  $_POST['jantina'] == '' )
{
} else {
    $nokp = $_POST['nokp'];
    $pass = $_POST['pass'];
    $repass = $_POST['repass'];
    $email = $_POST['email'];
    $nama = $_POST['nama'];
    $alamat = $_POST['alamat'];
    $poskod = $_POST['poskod'];
    $bandar = $_POST['bandar'];
    $kerja = $_POST['kerja'];
    $jantina = $_POST['jantina'];
        
    $ret = mysql_query("SELECT * FROM $dbtable");
    if (@mysql_num_rows($ret) != 0)
    {
        while ($row = mysql_fetch_array($ret))
        {
            if ($nokp == $row['nokp'])
            {
            ?>
            <script language=javascript>
            window.alert (" No IC ini telah didaftar!! Sila pilih No IC yang lain");
             </script>
            <?
            }
            
        }

    }
        if ($error != '')
    {
        echo $error;
        include 'files/footer.inc.php';
        echo "<form method=\"post\" action=\"index.php\">\n";
        exit;
    }
   
    $pass =($pass);
    $pass2 =($pass2);
    $keys = '`nokp`,`pass`,`repass`,`email`,`nama`,`alamat`,`poskod`,`bandar`,`pekerjaan`,`jantina`';
    $values = "'$nokp','$pass','$repass','$email','$nama','$alamat','$poskod','$bandar','$kerja','$jantina'";
    $ret = mysql_query("INSERT INTO $dbtable ($keys) VALUES ($values)");
   
    if (!$ret)
    {
        //exit('<strong>Error: </strong>Couldn\'t insert into MySQL Database.<br />'.mysql_errno().': '.mysql_error());
        echo "
        <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br />  <br />  <br />
        <font size=\"4\" >
        <p align='center'>
        <a href=\"daftarbaru.php\">Kembali Ke Bahagian Pendaftaran</a></font><p/>
        </strong></font>";
    } else { ?>
            <script language=javascript>
            window.alert ("Pendaftaran Anda telah berjaya. Sila Klik Kembali Ke Ruangan Login Untuk Memasuki Sistem!!");
             </script>
            <?
        /*echo "
   
    <p align='center'> <font size=\"4\" >
    Pendaftaran Anda Telah Berjaya. Sila Klik kembali ke bahagian login untuk memasuki Sistem.<br />
        ";*/
               
    }     
    }

include 'files/footer.inc.php';

?>
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

 

ADVERTISEMENT



 

ADVERTISEMENT


 


ADVERTISEMENT
Follow Us

ADVERTISEMENT


Mobile|Archiver|Mobile*default|About Us|CariDotMy

10-1-2025 06:16 AM GMT+8 , Processed in 0.322209 second(s), 25 queries , Gzip On, Redis On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

Quick Reply To Top Return to the list