Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6583139
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T16:22:11+00:00 2026-05-25T16:22:11+00:00

I am writing a php application that will post to a mySQL database. I

  • 0

I am writing a php application that will post to a mySQL database. I have that part working but I have a column named repID that will contain the clients repair ID.

The way the content gets added to the database is through an admin from on my website. I would like to make it so if a technician enters an existing repID that it will just update the key for that. Instead of making a duplicate with a different repair status

PHP

$repID = mysql_real_escape_string($_POST['repID']);
$clientName = mysql_real_escape_string($_POST['clientName']);
$devModel = mysql_real_escape_string($_POST['devModel']);
$repStatus = mysql_real_escape_string($_POST['repStatus']);
$tracking = mysql_real_escape_string($_POST['tracking']);
$sql = mysql_query("INSERT INTO status (`repID`, `clientName`, `devModel`, `repStatus`,     `tracking`) VALUES ('$repID','$clientName','$devModel','$repStatus', '$tracking');");

INPUT PAGE

<?php
include_once('../resources/init.php');
$query = "SELECT * FROM status WHERE repStatus != 'Finished';";
$result = mysql_query($query);
$num = mysql_numrows($result);
mysql_close();
$random = rand(1000000000, 9999999999);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"      "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
    <head>
        <title>Add A Repair</title>
    </head>
    <body>
        <div id="wrapper">
            <div id="application">
                <div id="randomNum">
                    <?php echo $random; ?>
                </div>
                <form method="post" action="insert.php">
                    <div id="repID">
                        <label for="repID">Repair ID</label>
                        <input type="text" name="repID" />
                    </div>
                    <div id="clientName">
                        <label for="clientName">Client Name</label>
                        <input type="text" name="clientName" />
                    </div>
                    <div id="devModel">
                        <label for="devModel">Device Model</label>
                        <input type="text" name="devModel" />
                    </div>
                    <div id="repStatus">
                        <label for="repStatus">Repair Status</label>
                        <select name="repStatus">
                            <option value="Diagnosis Stage">Diagnosis Stage</option>
                            <option value="Problem Found">Problem Found</option>
                            <option value="Possible Solution">Possible Solution</option>
                            <option value="Parts Ordered">Parts Ordered</option>
                            <option value="Parts Recieved">Parts Recieved</option>
                            <option value="Parts/Software Installation Stage">Parts/Software       m  Installation Stage</option>
                            <option value="Testing Stage">Testing Stage</option>
                            <option value="Finished">Finished</option>
                        </select>
                    </div>
                    <div id="tracking">
                        <label for="tracking">Tracking Number</label>
                        <input type="text" name="tracking" />
                    </div>
                    <div id="submit">
                        <input type="submit" value="Submit" />    
                    </div>
                </form>
                <div id="currentClients">
                    Current Clients
                    <br /><br />
                    <table border="0" cellspacing="2" cellpadding="2">
                        <tr>    
                            <th>Repair ID</th>
                            <th>Client Name</th>
                            <th>Device Model</th>
                            <th>Repair Status</th>
                            <th>Tracking</th>
                        </tr>
                        <?php
                        $i = 0;
                        while ($i < $num) {
                            $v1 = mysql_result($result, $i, "repID");
                            $v2 = mysql_result($result, $i, "clientName");
                            $v3 = mysql_result($result, $i, "devModel");
                            $v4 = mysql_result($result, $i, "repStatus");
                            $v5 = mysql_result($result, $i, "tracking");
                            ?>
                            <tr>
                                <td><?php echo $v1; ?></td>
                                <td><?php echo $v2; ?></td>
                                <td><?php echo $v3; ?></td>
                                <td><?php echo $v4; ?></td>
                                <td><?php echo $v5; ?></td>
                            </tr>
                            <?php
                            $i++;
                        }
                        ?>
                    </table>
                </div>
            </div>
        </div>
    </body>
</html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T16:22:12+00:00Added an answer on May 25, 2026 at 4:22 pm

    Use MySQL’s INSERT … ON DUPLICATE KEY UPDATE. Of course make sure repID is a primary or unique key.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am writing a PHP application that will have the ability to edit settings
I am writing a web application in PHP that will store large numbers of
Greetings, Overflowers! I am writing an application in PHP that will allow for editing
I'm writing a PHP application that manages some LDAP entries. I have one page
I'm building a php application that will have many modules/plugins. The issue is that
I'm writing an application in PHP that uses a LOT of global variables that
I'm writing a CMS application in PHP and one of the requirements is that
I'm currently writing a PHP application and drivers (classes) for the database engines. I
In a PHP application I am writing, I would like to have users enter
I am writing an application and I will have some dictionary values in many

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.