{"id":344,"date":"2025-05-28T00:10:05","date_gmt":"2025-05-28T00:10:05","guid":{"rendered":"https:\/\/hisage.jeffs-design.com\/?page_id=344"},"modified":"2025-05-28T00:10:05","modified_gmt":"2025-05-28T00:10:05","slug":"company-maint","status":"publish","type":"page","link":"https:\/\/hisage.jeffs-design.com\/index.php\/company-maint\/","title":{"rendered":"Company Maint"},"content":{"rendered":"\n<?php\n\/\/ Database connection\n$host = 'localhost';\n$user = 'root';\n$password = '';\n$database = 'i1491446_wp9';\n\n$conn = new mysqli($host, $user, $password, $database);\nif ($conn->connect_error) die(&#8220;Connection failed: &#8221; . $conn->connect_error);\n\n\/\/ Add company\nif (isset($_POST[&#8216;add&#8217;])) {\n    $name = $conn->real_escape_string($_POST[&#8216;name&#8217;]);\n    if (!empty($name)) {\n        $conn->query(&#8220;INSERT INTO companies (name) VALUES (&#8216;$name&#8217;)&#8221;);\n    }\n}\n\n\/\/ Update company\nif (isset($_POST[&#8216;update&#8217;])) {\n    $id = intval($_POST[&#8216;id&#8217;]);\n    $name = $conn->real_escape_string($_POST[&#8216;name&#8217;]);\n    if ($id &#038;&#038; !empty($name)) {\n        $conn->query(&#8220;UPDATE companies SET name = &#8216;$name&#8217; WHERE id = $id&#8221;);\n    }\n}\n\n\/\/ Delete company\nif (isset($_POST[&#8216;delete&#8217;])) {\n    $id = intval($_POST[&#8216;id&#8217;]);\n    if ($id) {\n        $conn->query(&#8220;DELETE FROM companies WHERE id = $id&#8221;);\n    }\n}\n\n\/\/ Fetch companies\n$result = $conn->query(&#8220;SELECT * FROM companies&#8221;);\n?>\n\n<!DOCTYPE html>\n<html>\n<head>\n    <title>Company Manager<\/title>\n<\/head>\n<body>\n    <h1>Manage Companies<\/h1>\n\n    <form method=\"post\">\n        <input type=\"text\" name=\"name\" placeholder=\"Company Name\" required>\n        <button type=\"submit\" name=\"add\">Add<\/button>\n    <\/form>\n\n    <h2>Existing Companies<\/h2>\n    <table border=\"1\" cellpadding=\"8\">\n        <tr>\n            <th>ID<\/th>\n            <th>Company Name<\/th>\n            <th>Actions<\/th>\n        <\/tr>\n        <?php while ($row = $result->fetch_assoc()): ?>\n        <tr>\n            <form method=\"post\">\n                <td><?= $row['id'] ?><\/td>\n                <td>\n                    <input type=\"text\" name=\"name\" value=\"<?= htmlspecialchars($row['name']) ?>&#8221; required>\n                    <input type=\"hidden\" name=\"id\" value=\"<?= $row['id'] ?>&#8220;>\n                <\/td>\n                <td>\n                    <button type=\"submit\" name=\"update\">Update<\/button>\n                    <button type=\"submit\" name=\"delete\" onclick=\"return confirm('Are you sure?')\">Delete<\/button>\n                <\/td>\n            <\/form>\n        <\/tr>\n        <?php endwhile; ?>\n    <\/table>\n<\/body>\n<\/html>\n","protected":false},"excerpt":{"rendered":"<p>Company Manager Manage Companies Add Existing Companies ID Company Name Actions &#8220;> Update Delete<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"class_list":["post-344","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/hisage.jeffs-design.com\/index.php\/wp-json\/wp\/v2\/pages\/344","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hisage.jeffs-design.com\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/hisage.jeffs-design.com\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/hisage.jeffs-design.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hisage.jeffs-design.com\/index.php\/wp-json\/wp\/v2\/comments?post=344"}],"version-history":[{"count":1,"href":"https:\/\/hisage.jeffs-design.com\/index.php\/wp-json\/wp\/v2\/pages\/344\/revisions"}],"predecessor-version":[{"id":345,"href":"https:\/\/hisage.jeffs-design.com\/index.php\/wp-json\/wp\/v2\/pages\/344\/revisions\/345"}],"wp:attachment":[{"href":"https:\/\/hisage.jeffs-design.com\/index.php\/wp-json\/wp\/v2\/media?parent=344"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}