www.webdeveloper.com
Results 1 to 2 of 2

Thread: ORACLE SQL Doesnt Work

  1. #1
    Join Date
    Mar 2014
    Posts
    2

    ORACLE SQL Doesnt Work

    hi folks,

    I am designing a code that pulls the info from the database. and the query involves 2 tables for the information. It doesnt work when i click submit. My code is like this,

    Code:
    <?php
                if ($_POST['action'] == 'show'){
    
                    $requestCompSql = "SELECT REQUEST_COMPONENT_CUTTING.PROJECT_NAME, 
                                              REQUEST_COMPONENT_CUTTING.BASE_PLATE, 
                                              REQUEST_COMPONENT_CUTTING.THICKNESS, 
                                              REQUEST_COMPONENT_CUTTING.QTY_REQUESTED,
                                                    COMPONENT_CUTTING.QTY_REQUIRED,
                                              REQUEST_COMPONENT_CUTTING.REQUESTER, 
                                              REQUEST_COMPONENT_CUTTING.REQUEST_DATE 
                                                    FROM REQUEST_COMPONENT_CUTTING INNER JOIN COMPONENT_CUTTING
                                                    ON REQUEST_COMPONENT_CUTTING.PROJECT_NAME = COMPONENT_CUTTING.PROJECT_NAME
                                                        WHERE REQUEST_COMPONENT_CUTTING.THICKNESS = COMPONENT_CUTTING.THICKNESS
                                                        AND REQUEST_COMPONENT_CUTTING.BASE_PLATE = COMPONENT_CUTTING.BASE_PLATE
                                                        AND COMPONENT_CUTTING.BASE_PLATE = '{$_POST["bp"]}'";
    
                    $requestCompParse = oci_parse($conn, $requestCompSql);
    
                    oci_execute($requestCompParse);
    
                    while($row = oci_fetch_assoc($requestCompParse)){
    
                    echo "<div class='table-responsive'>";
                    echo "<table class='table table-bordered'>";
                                            echo '<table cellspacing = "0"';
                                                echo '<thead>';
                                                echo '<tr>
                                                          <th>PROJECT</th>
                                                          <th>BASEPLATE</th>
                                                          <th>THICKNESS</th>
                                                          <th>QTY REQUESTED</th>
                                                          <th>QTY REQUIRED</th>
                                                          <th>REQUESTER</th>   
                                                          <th>REQ. DATE</th>
                                                          <th align="center">ACTION</th>  
                                                      </tr>
                                                      </thead>';
    
                                                 echo "<tbody>";
                                                    echo "<tr class='warning'><td>$row[PROJECT_NAME]</td>";
                                                    echo "<td>$row[BASE_PLATE]</td>";
                                                    echo "<td>$row[THICKNESS]</td>";
                                                    echo "<td>$row[QTY_REQUESTED]</td>";
                                                    echo "<td>$row[QTY_REQUIRED]</td>";
                                                    echo "<td>$row[REQUESTER]</td>";
                                                    echo "<td>$row[REQUEST_DATE]</td>";
                                                    echo "<td><input type='button' value='OK' class='btn btn-success'>
                                                        <input type='button' value='REJECT' class='btn btn-danger'></td>";
    
                                                    echo "</tr>";
                                                 echo "</tbody>";
                                             echo "<table cellspacing = '0'";
                                             echo "</div>";
                    }
    
                }
    
                ?>
    I dont know whats wrong with this code. I need your help guys with the query

  2. #2
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,361
    First thing to do is to add some debug code, e.g.:
    PHP Code:
                    $requestCompParse oci_parse($conn$requestCompSql);
                    if(
    $requestCompParse == false) {
                        throw new 
    Exception('Parse failed'.PHP_EOL.print_r(oci_error(),1).PHP_EOL.$requestCompSql);
                    }
                    if(
    oci_execute($requestCompParse) == false) {
                        throw new 
    Exception('Execute failed'.PHP_EOL.print_r(oci_error(),1).PHP_EOL.$requestCompSql);
                    } 
    Then at least you'll (hopefully) know what the DBMS was complaining about, plus you'll have the actual query that was used in the debug query if you want to try using it directly in a DB tool or command line SQL to test it.
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles