Go Back   Webmaster Malaysia Forum » Website Design & Development » Website Programming

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 25-08-2003, 10:58 AM
progmania's Avatar
Inspired Webmaster
 
Join Date: Aug 2003
Location: localhost PJ
Posts: 101
Rep Power: 66
progmania is on a distinguished road
Send a message via Yahoo to progmania
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...


Quote:
<?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!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 25-08-2003, 02:04 PM
lcf's Avatar
lcf lcf is offline
Pro-Blogger
 
Join Date: Feb 2003
Location: Kluang, Johor
Posts: 2,376
Rep Power: 116
lcf will become famous soon enough
Send a message via ICQ to lcf Send a message via MSN to lcf Send a message via Yahoo to lcf
tukar:
if ($pwd = $dbid && $nama = $dbname)

kepada:
if (($pwd == $dbid) && ($nama == $dbname))
__________________
LiewCF | Malaysia Bloggers Forum
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 25-08-2003, 02:08 PM
lcf's Avatar
lcf lcf is offline
Pro-Blogger
 
Join Date: Feb 2003
Location: Kluang, Johor
Posts: 2,376
Rep Power: 116
lcf will become famous soon enough
Send a message via ICQ to lcf Send a message via MSN to lcf Send a message via Yahoo to lcf
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.
__________________
LiewCF | Malaysia Bloggers Forum
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 25-08-2003, 03:46 PM
progmania's Avatar
Inspired Webmaster
 
Join Date: Aug 2003
Location: localhost PJ
Posts: 101
Rep Power: 66
progmania is on a distinguished road
Send a message via Yahoo to progmania
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!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
masalah online meiji Website Programming 3 28-01-2005 08:43 PM
Masalah dengan SWISH 2.0 ~~!! Movexz Mamak Stall 6 13-09-2003 05:23 PM
masalah session_start(); lktt Website Programming 1 31-07-2003 10:09 PM
Masalah PHP guna DWMX lktt Website Programming 1 25-07-2003 01:25 AM
Masalah Skit mshahir Website Programming 1 14-03-2003 09:25 AM



All times are GMT +8. The time now is 07:58 AM. Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0 vBulletin skin by ForumMonkeys.com.


WebmasterMalaysia.com is Proudly Hosted by Exabytes Semi Dedicated Server.

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