Results 1 to 4 of 4

Thread: php+sql : masalah coding

  1. #1
    Join Date
    Aug 2003
    Location
    localhost PJ
    Posts
    101
    Rep Power
    199

    Question php+sql : masalah coding

    assalamualaikum... & hello all...

    mintak tolong skit leh tak? tolong tgkkan coding saya kat bawah nih... aper yg tak kena.... bahagian print "selamat datang, $nama";---> output: selamat datang resource#3. macam mana saya nak tukar resource#3 tu jadi username yg diinputkan @ username dr database...... terima kasih...


    <?php
    include("log_query.php");


    $con = mysql_connect($server, $user, $pass)or die("Sambungan ke server gagal! ".mysql_error());

    $db="employee";
    mysql_select_db($db, $con);

    $dbid = mysql_query("SELECT emp_id from log");
    $dbname = mysql_query("SELECT emp_name from log");

    $pwd = $_POST["pass"];
    $nama = $_POST["name"];

    if ($pwd = $dbid && $nama = $dbname)
    {
    print "Selamat Datang, $nama" ;
    }
    elseif ($pwd != $dbid || $nama != $dbname)
    {
    print "Masukkan nama dan password yang betul";
    }
    else
    {
    print "Sila dapatkan nama dan katalaluan yg betul dari pihak Admin";
    }

    mysql_close($con);

    ?>
    Set the goal, push to the limit, reach the top and u'll be proud.. Try lah!

  2. #2
    Join Date
    Feb 2003
    Location
    Kluang, Johor
    Posts
    2,367
    Rep Power
    249
    tukar:
    if ($pwd = $dbid && $nama = $dbname)

    kepada:
    if (($pwd == $dbid) && ($nama == $dbname))

  3. #3
    Join Date
    Feb 2003
    Location
    Kluang, Johor
    Posts
    2,367
    Rep Power
    249
    well, basically your code is wrong.

    The following code...
    PHP Code:
    $dbid mysql_query("SELECT emp_id from log");
    $dbname mysql_query("SELECT emp_name from log"); 
    will return ALL the emp_id and emp_name in the tables... the return results cannot use to check the user name and password without looping in.

  4. #4
    Join Date
    Aug 2003
    Location
    localhost PJ
    Posts
    101
    Rep Power
    199
    heheh.... well thanks....

    i'll try to refer to internet tutorial, but still cant understand... the coding is very long.... so i just try to do it my self. i just wanna do a simple coding by myself.. so i can understand all the steps. ive been doin this coding since last week... but still havent finish it. i dont want to just copy coding from internet and paste it. i wanna do it my self. i think thats the best way to learn... eventhough it might take a long time to finished just one coding but i think its worthed.

    anyway thanks for your guide...
    Set the goal, push to the limit, reach the top and u'll be proud.. Try lah!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. masalah wordpress....
    By syedafiq in forum Website Programming
    Replies: 2
    Last Post: 07-12-2007, 12:21 PM
  2. masalah online
    By meiji in forum Website Programming
    Replies: 3
    Last Post: 28-01-2005, 08:43 PM
  3. Masalah dengan SWISH 2.0 ~~!!
    By Movexz in forum Mamak Stall
    Replies: 6
    Last Post: 13-09-2003, 05:23 PM
  4. masalah session_start();
    By lktt in forum Website Programming
    Replies: 1
    Last Post: 31-07-2003, 10:09 PM
  5. Masalah Skit
    By mshahir in forum Website Programming
    Replies: 1
    Last Post: 14-03-2003, 09:25 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Search Engine Optimization by vBSEO 3.5.0 RC1 PL1

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112