Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

128
Views
jquery or php if X is greater than Y

I'm making a website that displays a basic crud that shows Companyname, Stock, Minumum, Maximum.

I would like to display an alert or a message somewhere if the Stock is greater than the maximum. How could I go about doing this? Here is my display page code.

<table class="table">
    <thead>
        <tr>
        <th>ID</th>
        <th>Company Name</th>
        <th>Stock</th>
        <th>Minumum</th>
        <th>Maximum</th>
        <th>Action</th>
    </tr>
    </thead>

    <tbody> 
        <?php
            if ($result->num_rows > 0) {
                while ($row = $result->fetch_assoc()) {
        ?>
                    <tr>
                    <td><?php echo $row['id']; ?></td>
                    <td><?php echo $row['companyname']; ?></td>
                    <td><?php echo $row['stock']; ?></td>
                    <td><?php echo $row['minumum']; ?></td>         
                    <td><?php echo $row['maximum']; ?></td>
                    <td><a class="btn btn-info" href="update1.php?id=<?php echo $row['id']; ?>">Edit</a>&nbsp;<a class="btn btn-danger" href="delete1.php?id=<?php echo $row['id']; ?>">Delete</a></td>
                    </tr>   
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You can put an additional message in the Stock column with an if statement.

<td><?php echo $row['stock']; ?></td>

with

<td><?php echo $row['stock']; if ($row['stock'] > $row['maximum']) { echo " > maximum"; } ?></td>
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!