php - Cant add new record to database -


I am trying to add new records to my database via php but I can not get it to work I have triple examined all my values, correct table / row names, but still not working, maybe a second pair eyes can see my problem.

This is my form ...

  & lt; Form action = "method =" POST "& gt; & Lt; Table cellpadding = "5" cellspacing = "2" border = "0" & ​​gt; & Lt ;? Php echo '& lt; Textarea name = "addname" cols = "20" rows = "1" & gt; Enter new name & lt; / textarea> '; Echo '& lt; Textarea name = "adddescription" cols = "110" line = "5" & gt; Enter new details & lt; / textarea> '; Echo '& lt; Textarea name = "addpagetitle" cols = "100" rows = "3" & gt; Enter new page title & lt; / Textarea> '; Echo '& lt; Textarea name = "addpagetags" cols = "100" line = "2" & gt; Enter new page tag & lt; / textarea> '; Echo '& lt; Textarea name = "addmetadescription" cols = "100" rows = "5" & gt; Enter new meta description & lt; / textarea> '; ? & Gt; & Lt; / Table & gt; & Lt; / Form & gt;   

Here's your button ...

  & lt; Input type = "hidden" name = "added" value = "" /> & Lt; Input type = "submit" value = "add" name = "add" style = "background: # e5f9bb; cursor: indicator; cursor: hand;" / & Gt;   

My job is to add a new record.

  if (isset ($ _ POST ['add'])) {$ newname = $ _POST ['addname']; $ Nudiception = $ _POST ['Adwords']; $ Newpagetitle = $ _POST ['Adipagative']; $ Numetki = $ _POST ['Appetigates']; $ Newmetadesicle = $ _POST ['AdMedBasination']; // adds new destination and info ... mysql_query ("name, description, page_ title, page_tag, p_data_tag) values ​​('$ newname', '$ newdescription', '$ newpagetitle', '$ newmetakey', '$ newmetadescription ') "); }   

In addition to this, I also want to double that if added, SQL has provided the new record a primary key which will be IDDestination in my case. Or do I need the code in my own? Thanks to who might be my problem!

Change your query to:

  mysql_query ("destination ('". $' Newname. '' ',' $. '' '', ''. $ Newpagetitle. '', '". $ Newmetakey (Include name, description, page_title, page_tag, page_valit_tag) "',' '$ Newmetadescription.' ')");   

You can use the free increase for your primary key (sorry, maybe I should understand your last question)

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -