Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2014
    Posts
    44

    Unanswered: Avoiding duplicates in PHP + ORACLE

    Hi folks,

    how to avoid duplicate inputs in PHP input form. I am using Oracle DB as by database. My expected output outcome is to use dropdown list in which user can input the name. But, when there is duplicates, it tells the user that the entry already exists.

    I am assuming we need to query the list first and check throughout the db

    please help me ,

    Ch

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    so you need to create your form
    then you need to process the data in that form
    and take appropriate action
    some people validate within the same form some people pass the data to a validation script

    you validation script needs to check against the db

    al scripts that accept data from a user / the external world MUST check that data is valid and also is not corrupt... look up SQL injection
    look up PHP's [POST] and [GET] variables
    look up data entry
    look up form handling
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Mar 2014
    Posts
    44
    Quote Originally Posted by healdem View Post
    so you need to create your form
    then you need to process the data in that form
    and take appropriate action
    some people validate within the same form some people pass the data to a validation script

    you validation script needs to check against the db

    al scripts that accept data from a user / the external world MUST check that data is valid and also is not corrupt... look up SQL injection
    look up PHP's [POST] and [GET] variables
    look up data entry
    look up form handling
    thanks healdem

  4. #4
    Join Date
    Mar 2014
    Posts
    44
    HI healdem Im having a problem with inputting the value from dropdown box,

    my HTML is

    Code:
    <td valign="left">
                    <select>
                        <option value="HB">H-BEAM</option>
                        <option value="WF">I-BEAM</option>
                        <option value="UNP">U-CHANNEL</option>
                        <option value="CNP">C-CHANNEL</option>
                        <option value="D">D</option>
                        <option value="PLT">PLATE</option>
                        <option value="L">L-ANGLE</option>
                     </select>
                </td>
    and my engine,

    PHP Code:
    $insertSQL "INSERT INTO MASTER_DRAWING 
           (head_mark, rev_no, rev_date, comp_type, web, flange, web_thick, flange_thick, length, qty, weight, surface)
            VALUES (:hm, :rn, :rd, :ct, :wb, :fl, :wbt, :flt, :ln, :qt, :wt, :sf)"
    ;
               
       
    $s oci_parse($conn$insertSQL);
       
       
    oci_bind_by_name($s":hm"$_POST['head_mark']);
       
    oci_bind_by_name($s":rn"$_POST['rev_no']);
       
    oci_bind_by_name($s":rd"$_POST['rev_date']);
       
    oci_bind_by_name($s":ct"$_POST['comp_type']);
       
    oci_bind_by_name($s":wb"$_POST['web']);
       
    oci_bind_by_name($s":fl"$_POST['flange']);
       
    oci_bind_by_name($s":wbt"$_POST['web_thick']);
       
    oci_bind_by_name($s":flt"$_POST['flange_thick']);
       
    oci_bind_by_name($s":ln"$_POST['length']);
       
    oci_bind_by_name($s":qt"$_POST['qty']);
       
    oci_bind_by_name($s":wt"$_POST['weight']);
       
    oci_bind_by_name($s":sf"$_POST['surface']);
       
       
    $form_execute oci_execute($sOCI_DEFAULT); 
    Somwhow it cant take the value from the HTML page and insert it into the database. I am getting null value when i show the whole database

  5. #5
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Post the results of
    Code:
    echo $insertSQL;
    George
    Home | Blog

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
  •