• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

php basic

 
bala kan
Ranch Hand
Posts: 44
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It seems that you posted index.php twice, but not insert.php.
 
bala kan
Ranch Hand
Posts: 44
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
K, ulf.. just now i have edited the post.. please check it and clarify me

Regards,
Bala
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic