{"id":968,"date":"2022-08-30T15:10:11","date_gmt":"2022-08-30T15:10:11","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/11\/09\/inserting-curdate-and-curtime-in-mysql-php-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:10:11","modified_gmt":"2022-08-30T15:10:11","slug":"inserting-curdate-and-curtime-in-mysql-php-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/inserting-curdate-and-curtime-in-mysql-php-collection-of-common-programming-errors\/","title":{"rendered":"Inserting CURDATE() and CURTIME() in MySQL (PHP)-Collection of common programming errors"},"content":{"rendered":"<p>You have a syntax error &#8211; a comma on the end of the query:<\/p>\n<pre><code>'\".$name.\"', '\".$email.\"',)\";\n                         ^ here\n<\/code><\/pre>\n<p>Remove it, so the full query becomes:<\/p>\n<pre><code>$query = \"INSERT INTO `ordisp` (date, time, operator, status, completed, name, email) VALUES (CURDATE(), CURTIME(), '\".$operator.\"', '\".$status.\"', '\".$complete.\"', '\".$name.\"', '\".$email.\"')\";\n<\/code><\/pre>\n<p>For future debugging you should look at the MySQL error, it will give you a description of the problem, for example unknown field\/table name or a syntax error etc etc.<\/p>\n<p id=\"rop\"><small>Originally posted 2013-11-09 23:08:27. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>You have a syntax error &#8211; a comma on the end of the query: &#8216;&#8221;.$name.&#8221;&#8216;, &#8216;&#8221;.$email.&#8221;&#8216;,)&#8221;; ^ here Remove it, so the full query becomes: $query = &#8220;INSERT INTO `ordisp` (date, time, operator, status, completed, name, email) VALUES (CURDATE(), CURTIME(), &#8216;&#8221;.$operator.&#8221;&#8216;, &#8216;&#8221;.$status.&#8221;&#8216;, &#8216;&#8221;.$complete.&#8221;&#8216;, &#8216;&#8221;.$name.&#8221;&#8216;, &#8216;&#8221;.$email.&#8221;&#8216;)&#8221;; For future debugging you should look at the MySQL error, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-968","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/968","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=968"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/968\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=968"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=968"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=968"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}