5 Years
Discussion Span
Last Post by michel.cote


First to address the database error. I'm not seeing mysql_connect anywhere in the code above. Is the database call made into config.php?

You might want to rewrite that since mysql_connect and related functions are deprecated. Click Here to read more about that

Also you're not providing the initial HTML form so it's hard to see if you might have a typo in the field names but I'm thinking you might not be "POSTING" your form.

I don't know how familiar you are with forms and PHP but there are 2 ways to send information from a form.

  1. get - Get is similar to writing a URL like daniweb.com/form.php?var1=value1&var2=value2
  2. post - submits data to be processed to the identified resource.

Here is a great explanation

So in a nut shell if your HTML form doesn't state what method to use it will default to "get" and PHP will get the values from the $_GET global variable instead of $_POST. Make sure your form states method="post". :)

Edited by michel.cote


my database call is made in the config.php , here's the code :

$con = mysql_connect('localhost','root','') or die(mysql_error());
mysql_select_db('agenda',$con) or die(mysql_error()); 

My form states "post" method i checked it


Hmm ok...

Well if your script dies and reports an error with no database selected then it must mean the mysql_connect and mysql_select_db are not called for some reason.

Do you mind posting the full config.php code? Just obfuscate any sensitive data (as opposed to simply removing it like your password in the previous post). A note on your connect function it is not recommended to use root in a production setting, I even frown on using root in development too. You should create a specific user for that database and give it specific rights to select, update, delete etc...

Edited by michel.cote: Corrected gramatical errors.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.