www.webdeveloper.com
Results 1 to 5 of 5

Thread: Need help in getting the value of one field to be used in mysql select query

Hybrid View

  1. #1
    Join Date
    Oct 2011
    Posts
    350

    Need help in getting the value of one field to be used in mysql select query

    Hi,

    I need to get the process_id or process_name to select the reject type on the table reject_list. But I don't know how and is it possible that after I input the process_name I will get the value then it will be use in my select query to get the reject list.

    Code:
    <?php
      session_start();
      ob_start();
      date_default_timezone_set("Asia/Singapore");
      error_reporting(0);  
      include('connection.php');
      
     
    //----QUERY FOR REJECT TYPE---//
    
    if(isset($_SESSION['process_name']) != '')
    {
        
        $process_id = $_SESSION['process_id'];
        $sql_reject = ("SELECT reject_process_id, reject_acro FROM reject_list WHERE reject_process_id = '$process_id'");
    
    echo $sql_reject;
    }
    ?>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <title>Operator's Shift Report </title>
    <head>
    <link rel="stylesheet" type="text/css" href="op_report.css" />
    <link rel="stylesheet" type="text/css" href="calendar.css" />
    
    <script type="text/javascript" src="jquery.js"></script>
    <script type='text/javascript' src='jquery.autocomplete.js'></script>
    <link rel="stylesheet" type="text/css" href="jquery.autocomplete.css" />
    
    <script type="text/javascript">
    //----auto complete process name---//
    $().ready(function() {
        $("#process_name").autocomplete("get_process_list.php", {
           width: 205,
            matchContains: true,
            mustMatch: true,
            selectFirst: false
        });
        
        $("#process_name").result(function(event, data, formatted) {
            $("#process_id").val(data[1]);
        });
        
    });
    
    
    </script>
    </head>
    <body onload=document.getElementById("process_name").focus();>
    <form>
    <script type="text/javascript" src="calendar.js"> </script> 
    <div id="operators_report">
    <fieldset>
    <legend><h1>Operator's Shift Report</h1></legend>
    <table>
    <tr>
    <td>Process:</td>
    <td><input type="text" name="process_name" id="process_name" value="" size="30"></td>
    <td>Supervisor:</td>
    <td><input type="text" name="supervisor" id="supervisor" value="" size="30"></td>
    </tr>
    
    </table>
    </fieldset>
    </div>
    <input type="hidden" name="process_id" id="process_id" value="" />
    <input type="hidden" name="spv_id" id="spv_id" value="" />
    </form>
    </body>
    </html>
    Any help is highly appreciated.

    Thank you.

  2. #2
    Join Date
    Jul 2013
    Location
    Voorheesville NY USA
    Posts
    802
    You seem to have a query altho your selection value seems odd - you tested one var but used another.

    What happens when you run the query? What do you want to happen.

    btw - you can't echo the results var.

  3. #3
    Join Date
    Oct 2011
    Posts
    350
    in this code once I type on the process_name field it calls the code jquery to display the match data from the database. Then after i choose the process_name it automatically display the process_name in process_name field also the process_id on the process_id field, Now i want to happen is after choosing process_name it will display the reject_type based on that process_name.

    i don't know if it is impossible and what syntax should I use.
    Thank you

  4. #4
    Join Date
    Jul 2013
    Location
    Voorheesville NY USA
    Posts
    802
    Sorry - I dont' know jquery, but your problem doesn't seem difficult. You get data from a query, you have your html, just output the query results vars where you want them. I don't understand your concern

  5. #5
    Join Date
    Oct 2011
    Posts
    350
    Quote Originally Posted by ginerjm View Post
    Sorry - I dont' know jquery, but your problem doesn't seem difficult. You get data from a query, you have your html, just output the query results vars where you want them. I don't understand your concern
    Thank you...I resolved it using AJAX.


    Thank you

Thread Information

Users Browsing this Thread

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

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