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

  • SEARCH
  • Home
  • 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 7852185
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T19:21:40+00:00 2026-06-02T19:21:40+00:00

I have a trouble with my code below : <form name=form method=get action= autocomplete=off>

  • 0

I have a trouble with my code below :

<form name="form" method="get" action="" autocomplete="off">
                                    <input class="text sign" type="text" name="q" id="q" onkeyup="SetButtonStatus(this, 'btnButton')"/>
                                    <span class="hint"><b>Tips :</b>
                                        <br>
                                        1. Search by <b>badgeid</b>, ex : 110702.<br>
                                        2. Search by <b>name</b>, ex : david.<br>
                                        3. Search by <b>otdate</b>, ex : 9-feb-2012.
                                    </span>
                                    <br>
                                    <input class="submit" type="submit" value="Search" ID="btnButton" disabled="disabled"/>
                                </form>

                            <?php
                                if(isset($_GET['q']) && $_GET['q'])
                                {
                                    include ("config.php");
                                    $q = $_GET['q'];
                                    $sql = "select t_submissions.submission_no,
                                    t_submissions.badge_id,
                                    t_submissions.employee_name,
                                    t_submissions.ot_date,
                                    t_submissions.ot_from,
                                    t_submissions.ot_to,
                                    t_submissions.submission_by,
                                    t_acknowledged.status_acknowledge,
                                    t_submissions.status_approve

                                    from t_submissions, t_acknowledged where t_submissions.employee_name like '%$q%' or ot_date like '%$q%' or t_submissions.badge_id like '%$q%' or t_submissions.submission_no=t_acknowledged.submission_no ORDER BY time_submission DESC";

                                    $result = mysql_query($sql) or trigger_error(mysql_error().$sql);
                                    if(mysql_num_rows($result) > 0)
                                    {
                                        ?>
                                        <div class="outer">
                                            <div style="height:342px; overflow:auto; width:818px;">
                                                <table cellspacing="0" class="font">
                                                <thead>
                                                    <tr>
                                                        <th class="th">Form No</th>
                                                        <th class="th">Badge ID</th>
                                                        <th class="th">Name</th>
                                                        <th class="th">OT Date</th>
                                                        <th class="th">OT From</th>
                                                        <th class="th">OT To</th>
                                                        <th class="th">Submission By</th>
                                                        <th class="th">Status Ack.</th>
                                                        <th class="th">Status App.</th>
                                                    </tr>                                               
                                                </thead>
                                                    <?php
                                                        while($submission = mysql_fetch_array($result))
                                                        {?>
                                                        <tbody>
                                                            <tr>
                                                                <td class="td"><?php echo $submission['submission_no'];?></td>
                                                                <td class="td"><?php echo $submission['badge_id'];?></td>
                                                                <td class="td"><?php echo $submission['employee_name'];?></td>
                                                                <td class="td"><?php echo $submission['ot_date'];?></td>
                                                                <td class="td"><?php echo $submission['ot_from'];?></td>
                                                                <td class="td"><?php echo $submission['ot_to'];?></td>
                                                                <td class="td"><?php echo $submission['submission_by'];?></td>
                                                                <td class="td"><?php echo $submission['status_acknowledge'];?></td>
                                                                <td class="td"><?php echo $submission['status_approve'];?></td>
                                                            </tr>
                                                        </tbody>
                                                    <?php }?>
                                                </table>
                                            </div>
                                        </div>
                                        <?php
                                    }
                                    else
                                    {
                                        echo '<p STYLE="position:absolute; TOP:170px; left:500px;">Data not found.</p>';
                                    }
                                }
                            ?>

This code are not error but not yet useful.
because when I try to find (example : find by date : “27-Apr-2012”) the data show, but it show with double data whereas in database that’s not a double data.

I suspect the code in here maybe :

$sql = "select t_submissions.submission_no,
                                    t_submissions.badge_id,
                                    t_submissions.employee_name,
                                    t_submissions.ot_date,
                                    t_submissions.ot_from,
                                    t_submissions.ot_to,
                                    t_submissions.submission_by,
                                    t_acknowledged.status_acknowledge,
                                    t_submissions.status_approve

                                    from t_submissions, t_acknowledged where t_submissions.employee_name like '%$q%' or ot_date like '%$q%' or t_submissions.badge_id like '%$q%' and t_submissions.submission_no=t_acknowledged.submission_no ORDER BY time_submission DESC";

how to combine 2 condition if it has “or” & “and” ?

Thank you for helping.

  • 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-06-02T19:21:41+00:00Added an answer on June 2, 2026 at 7:21 pm
    $sql = "select t_submissions.submission_no,
                                    t_submissions.badge_id,
                                    t_submissions.employee_name,
                                    t_submissions.ot_date,
                                    t_submissions.ot_from,
                                    t_submissions.ot_to,
                                    t_submissions.submission_by,
                                    t_acknowledged.status_acknowledge,
                                    t_submissions.status_approve
                                    from t_submissions, t_acknowledged where      
    (t_submissions.employee_name like '%$q%' 
    or ot_date like '%$q%' 
    or t_submissions.badge_id like '%$q%') 
    and t_submissions.submission_no=t_acknowledged.submission_no 
    ORDER BY time_submission DESC";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have trouble understanding the underlying errors with the code below: class myClass {
I have trouble to get gluLookAt working. I have the following code which works
I have the jsf code and css code below. I'm having trouble getting the
I have the Global.asax like the code below: public class MvcApplication : System.Web.HttpApplication {
i have trouble with optimization of the code below which is changing css property
Have som trouble getting the code below to work. I am trying to fire
I'm having trouble passing an array between methods and have excerpted my code below.
I have some code below, and I cant seem to get the matrices formatted
I have trouble with the following piece of code. When I go through with
I have trouble finding way to correctly refactor this code so that there would

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.