PHP code doesn't insert records into database -


this question has answer here:

my php program wont insert records entered in browser sql database. see code below. code update 1 asked earlier. suggested security among other reasons.

i not errors @ program runs fine in browser whenever check database no entries have been put in after running code. missing something?

<html> <head> </head>  <body> <form action="register_development_file_1b.php" method="post">     email:  <input type="text" name="email"><br />     date:   <input type="text" name="date"><br />     time:   <input type="text" name="time"><br />         <input type="submit" name="submit"> </form>  <?php      if(isset($_post['submit']))      {        $con = mysql_connect("localhost","username","password") or die(mysql_mysql);        mysql_select_db("databasename", $con) or die(mysql_query("databasename", $con));        $email = mysql_real_escape_string($_post['email']);       $date = mysql_real_escape_string($_post['date']);       $time = mysql_real_escape_string($_post['time']);         $sql = "insert              signups ('signup_email_address', 'signup_date','signup_time')              values  ('".$email."','".$date."','".$time."')";          mysql_query($sql, $con) or die(mysql_error());          mysql_close($con);     } ?> </body> </html> 

there typo in sql query. names of fields, ('signup_email_address', 'signup_date','signup_time') must not written between ''. used exclusively strings, among values, not names of fields, tables, schema or whatever. if want put between quotation marks, use ` instead.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -