{"id":1873,"date":"2018-10-26T10:27:16","date_gmt":"2018-10-26T10:27:16","guid":{"rendered":"https:\/\/ibex.tech\/cloud\/?p=1873"},"modified":"2022-02-17T07:14:02","modified_gmt":"2022-02-17T07:14:02","slug":"php4-insert","status":"publish","type":"post","link":"https:\/\/ibex.tech\/cloud\/mysql\/php-versions\/php4-old-code\/queries-php4-old-code\/php4-insert","title":{"rendered":"PHP4 INSERT"},"content":{"rendered":"<p>\n<span style=\"color:#FF0000;\"><em><strong>This is PHP4 Code!<\/strong><\/em><\/span>\n<\/p>\n<pre>\r\n<code>\r\n$result = @mysql_query(&quot;INSERT INTO text_messages (\r\n\t\t\tsome_id,\r\n\t\t\temail_address\r\n\t\t) VALUES (\r\n\t\t\t$some_id,\r\n\t\t\t&#39;$email&#39;\r\n\t\t)&quot;);\r\n<\/code><\/pre>\n<h5>\nDateTime Now<br \/>\n<\/h5>\n<pre>\r\n<code>\r\nNow(),\r\n<\/code><\/pre>\n<p>\n&nbsp;\n<\/p>\n<h4>\nGet Auto ID Of New Record<br \/>\n<\/h4>\n<pre>\r\n<code>\r\n$sql = &quot;INSERT INTO some_table (list_name, user_id) VALUES (&#39;$list_name&#39;, $user_id)&quot;;\r\n@mysql_query($sql);\r\n$my_variable = mysql_insert_id();\r\n<\/code><\/pre>\n<p>\nThe mysqli_insert_id() function returns the ID generated by a query on a table with a column having the AUTO_INCREMENT attribute. If the last query wasn&#39;t an INSERT or UPDATE statement or if the modified table does not have a column with the AUTO_INCREMENT attribute, this function will return zero.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is PHP4 Code! $result = @mysql_query(&quot;INSERT INTO text_messages ( some_id, email_address ) VALUES ( $some_id, &#39;$email&#39; )&quot;); DateTime Now Now(), &nbsp; Get Auto ID Of New Record $sql = &quot;INSERT INTO some_table (list_name, user_id) VALUES (&#39;$list_name&#39;, $user_id)&quot;; @mysql_query($sql); $my_variable = mysql_insert_id(); The mysqli_insert_id() function returns the ID generated by a query on a table [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[156],"tags":[],"class_list":["post-1873","post","type-post","status-publish","format-standard","hentry","category-queries-php4-old-code"],"_links":{"self":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts\/1873","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/comments?post=1873"}],"version-history":[{"count":1,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts\/1873\/revisions"}],"predecessor-version":[{"id":1874,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts\/1873\/revisions\/1874"}],"wp:attachment":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/media?parent=1873"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/categories?post=1873"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/tags?post=1873"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}