Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Feb 2006
    Posts
    107
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question how to get the value???

    hi everyone,i have a problem regarding how to get the value from database....

    <?php

    $query = "Select Patient_ID from tblpatient where Patient_ID='".$_POST["Patient_ID"]."' order by Patient_ID desc limit 1;";
    $result = mysql_query($query);
    $row = mysql_fetch_assoc($result);
    // echo $_POST['Patient_ID'];
    $newPatientID = $_POST["Patient_ID"] + 1;

    ?>
    i know my code is sth wrong dee....can anyone help me pls????
    thank u very much

  • #2
    Senior Coder whizard's Avatar
    Join Date
    Jan 2005
    Location
    Philadelphia, PA, USA
    Posts
    1,662
    Thanks
    14
    Thanked 76 Times in 76 Posts
    Try taking out the highlighted apostrophe....

    Code:
    $query = "Select Patient_ID from tblpatient where Patient_ID='".$_POST["Patient_ID"]."' order by Patient_ID desc limit 1;";
    Dan
    PHP Tip: If you want to use short tags (<? or <?=$var) then make sure short_open_tag is set to "1". It really helps.

    Don't forget to save everyone time and mark your thread as Resolved :)

    "Also note that it is your responsibility to die() if necessary."

    DON'T USE THE MYSQL_ EXTENSION

  • #3
    Regular Coder
    Join Date
    Feb 2006
    Posts
    107
    Thanks
    0
    Thanked 0 Times in 0 Posts
    but the result is still the same....actually i'm doing a form which is to add patient record.....then the patient ID is auto increment....so i need to display the previous patient ID + 1 inside the textbox....

    so what should i do???thank u veru much


  •  

    Posting Permissions

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