my dog learned polymorphism*
The moose likes PHP and the fly likes php basic Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Languages » PHP
Bookmark "php basic" Watch "php basic" New topic
Author

php basic

bala kan
Ranch Hand

Joined: Aug 20, 2012
Posts: 44
Hi Friends,

I am beginner in php.. i would like to create a page in which my requirement is i have to create 3 text fields (firstname,lastname,age) and one button (submit)..

after submitting the button (submit), it would insert the data into the table in mysql..


for this, i use one index page(index.php) and one insert page(insert.php)..

the index.php codings are


the insert.php codings are



but, after submitting the submit button, the following error occurs,

Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'bala'@'localhost' (using password: YES) in C:\wamp\www\php1\insert.php on line 8

Notice: Use of undefined constant mysql - assumed 'mysql' in C:\wamp\www\php1\insert.php on line 11

Fatal error: Call to undefined function error() in C:\wamp\www\php1\insert.php on line 11



please clarify my doubts..Thanks in advance..


Regards,
Bala


Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41601
    
  55
It seems that you posted index.php twice, but not insert.php.


Ping & DNS - my free Android networking tools app
bala kan
Ranch Hand

Joined: Aug 20, 2012
Posts: 44
K, ulf.. just now i have edited the post.. please check it and clarify me

Regards,
Bala
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41601
    
  55
There are apparently two problems: one is that you write "mysql.error" where it should probably be "mysql_error". The other is that user "bala" apparently does not have access right to the DB from localhost. Make sure that is allowed, and also try "127.0.0.1" instead of "localhost".
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: php basic