|
|||
My First PHP didn't work!
File 1
<HTML> <BODY> <form method="post" action="datain.php"> First name:<input type="Text" name="first"><br> Last name:<input type="Text" name="last"><br> Nick Name:<input type="Text" name="nickname"><br> E-mail:<input type="Text" name="email"><br> Salary:<input type="Text" name="salary"><br> <input type="Submit" name="submit" value="Enter information"> </form> </HTML> File 2 <HTML> <?php $db = mysql_connect("localhost", "root",""); mysql_select_db("learndb",$db); $sql = "INSERT INTO personnel (firstname, lastname, nick, email, salary) VALUES ('$first','$last','$nickname','$email','$salary')" ; $result = mysql_query($sql); echo "Thank you! Information entered.\n"; ?> </HTML> Why the mysql didn't add row? It that is becoz i am using phpdev for installing phpmyadmin & apache? pls advise |
|
||||
your first PHP is so complex.
![]() Do you get any error message? Make sure the database is connected. Also, your PHP file does not grab the input value at all. Please refer to "PHP Manual - Variables from outsite PHP" [ http://my2.php.net/variables.external ] Also your SQL query is not correct, try to replace this line: PHP Code:
PHP Code:
Last edited by lcf; 22-10-2004 at 05:56 PM. |
|
||||
lebih selamat kita guna $_POST array nih, pergantungan kepada register global akan memudahkan penggodam menjalankan aktiviti
sebelum masukkan data dalam mysql, jangan lupa escape string tu dulu menggunakan addslashes($string), atau pun mysql_escape_string($string)
__________________
http://sidik.org/ |
|
||||
cara yang boleh dilakukan, sekiranya register global on,kalo kita malas nak buat
PHP Code:
letak kod ni kat ataaas skali.. PHP Code:
__________________
http://sidik.org/ |
![]() |
«
Previous Thread
|
Next Thread
»
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How come he doesn't have to work??? | RB388 | Member Introductions | 14 | 10-01-2007 11:53 PM |
| check my work | punithan | Websites Review and Suggestion | 6 | 29-06-2005 07:20 PM |
| Don't want to pay to work at home? | gold2006 | Job Vacancies | 1 | 08-04-2005 03:03 PM |
| Will this tips work? | List | Mamak Stall | 6 | 18-10-2004 02:09 AM |
| How this work ??? | koisempoi | Website Programming | 4 | 04-06-2004 04:31 PM |
All times are GMT +8. The time now is 01:24 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.
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0 vBulletin skin by ForumMonkeys.com.













Linear Mode

