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.
Page 2 of 4 FirstFirst 1234 LastLast
Results 16 to 30 of 53

Thread: PHP / MsSQL

  1. #16
    Regular Coder
    Join Date
    Sep 2007
    Location
    Grahamstown, South Africa
    Posts
    237
    Thanks
    6
    Thanked 17 Times in 17 Posts
    Fou-Lu doesnt take kindly to mistakes. :-P

  2. #17
    Regular Coder
    Join Date
    Sep 2007
    Location
    Grahamstown, South Africa
    Posts
    237
    Thanks
    6
    Thanked 17 Times in 17 Posts
    PHP Code:
    <?php     
    /** 
    First thing, we create a function that will make your data safe! 
    **/ 
    function mssql_escape($data) { 
        if(
    is_numeric($data)) 
            return 
    $data
        
    $unpacked unpack('H*hex'$data); 
        return 
    '0x' $unpacked['hex']; 


    if (isset(
    $_POST['LOWNUMBER'])) {
        
    //now we loop through the post data and sanitize it! 
        
    foreach ($_POST as $key=>$value) { 
            
    $_POST[$key] = mssql_escape($value); 
        } 
        
        
    //now we build the query! 
        
    $strSQL "INSERT INTO MSAG ";   
        
    $strSQL .="(StreetName) ";   
        
    $strSQL .="VALUES ";   
        
    $strSQL .= "({$_POST['StreetName']})"
        
        
    //now we insert it 
        
    mssql_query($strSQL);
    }
    ?>

    <?php include 'includes/head/head_main.php'?> 

    <div id = "top_content"> 
    <body> 

    <?php include 'includes/header/header_main.php'?> 

    <h1>Add New Record</h1> 

    <div id = "enter_record"> 

    </center> 
    <div id = "modify"> 



    ?> 

    <form action="" method="post" enctype="multipart/form-data"> 

    <table> 
    <tr> 
    <td>Pre Dir:    <br><input type="text" name="StreetPrefix"> <br></td> 
    <td>Street:     <br><input type="text" name="StreetName"> <br></td> 
    <td>Suffix:     <br><input type="text" name="StreetSuffix"> <br></td> 
    <td>Post Dir:     <br><input type="text" name="StreetPostDir"> <br></td> 
    <td>Community:     <br><input type="text" name="COMMUNITY"> <br></td> 
    </tr></table> 
    <br> 

    <table>  
    <tr> 
    <td>Low:    <br><input type="text" name="LOWNUMBER"> <br></td> 
    <td>High:    <br><input type="text" name="HighNumber"> <br></td> 
    <td>EOB:    <br><input type="text" name="EOB"> <br></td> 
    <td>ESN:    <br><input type="text" name="ESN"> <br></td> 
    </tr> 
    </table> 
    <br> 

    <table>  
    <tr> 
    <td>Telco:    <br><input type="text" name="TELCO"> <br></td> 
    <td>ZIP:    <br><input type="text" name="PostOffice"> <br></td> 
    <td>Zone:    <br><input type="text" name="ZONE"> <br></td> 
    <td>Map:    <br><input type="text" name="MAP"> <br></td> 
    </tr> 
    </table> 
    <br> 

    <table> 
    <tr> 
    <td>Entered:    <br><input type="text" name="DateEntered"> <br></td> 
    <td>Modified:    <br><input type="text" name="DateUpdated"> <br></td> 
    </tr> 
    </table> 
    <br> 

    <table> 
    <tr> 
    <td>Comments:    <br><input type="text" name="Commments"> <br></td> 
    </tr> 
    </table> 
    <br> 
    </div> 

    <input type="submit" align = "left" name="submit" value="Submit"/> 
    </table> 

    </form> 
    <br>     

    </div>

  3. #18
    New Coder
    Join Date
    Aug 2012
    Posts
    65
    Thanks
    5
    Thanked 0 Times in 0 Posts
    The form shows up fine on this one, however, on submit, it thows an internal 500 error. I turned on error reporting, but that didnt help at all:

    PHP Code:
    <?php

    ini_set
    ('error_reporting'E_ALL);


       
    /** 
    First thing, we create a function that will make your data safe! 
    **/ 
    function mssql_escape($data) { 
        if(
    is_numeric($data)) 
            return 
    $data
        
    $unpacked unpack('H*hex'$data); 
        return 
    '0x' $unpacked['hex']; 


    if (isset(
    $_POST['LOWNUMBER'])) {
        
    //now we loop through the post data and sanitize it! 
        
    foreach ($_POST as $key=>$value) { 
            
    $_POST[$key] = mssql_escape($value); 
        } 
        
        
    //now we build the query! 
        
    $strSQL "INSERT INTO MSAG ";   
        
    $strSQL .="(StreetName) ";   
        
    $strSQL .="VALUES ";   
        
    $strSQL .= "({$_POST['StreetName']})"
        
        
    //now we insert it 
        
    mssql_query($strSQL);
    }
    ?>

    <?php include 'includes/head/head_main.php'?> 

    <div id = "top_content"> 
    <body> 

    <?php include 'includes/header/header_main.php'?> 

    <h1>Add New Record</h1> 

    <div id = "enter_record"> 

    </center> 
    <div id = "modify"> 



    <form action="" method="post" enctype="multipart/form-data"> 

    <table> 
    <tr> 
    <td>Pre Dir:    <br><input type="text" name="StreetPrefix"> <br></td> 
    <td>Street:     <br><input type="text" name="StreetName"> <br></td> 
    <td>Suffix:     <br><input type="text" name="StreetSuffix"> <br></td> 
    <td>Post Dir:     <br><input type="text" name="StreetPostDir"> <br></td> 
    <td>Community:     <br><input type="text" name="COMMUNITY"> <br></td> 
    </tr></table> 
    <br> 

    <table>  
    <tr> 
    <td>Low:    <br><input type="text" name="LOWNUMBER"> <br></td> 
    <td>High:    <br><input type="text" name="HighNumber"> <br></td> 
    <td>EOB:    <br><input type="text" name="EOB"> <br></td> 
    <td>ESN:    <br><input type="text" name="ESN"> <br></td> 
    </tr> 
    </table> 
    <br> 

    <table>  
    <tr> 
    <td>Telco:    <br><input type="text" name="TELCO"> <br></td> 
    <td>ZIP:    <br><input type="text" name="PostOffice"> <br></td> 
    <td>Zone:    <br><input type="text" name="ZONE"> <br></td> 
    <td>Map:    <br><input type="text" name="MAP"> <br></td> 
    </tr> 
    </table> 
    <br> 

    <table> 
    <tr> 
    <td>Entered:    <br><input type="text" name="DateEntered"> <br></td> 
    <td>Modified:    <br><input type="text" name="DateUpdated"> <br></td> 
    </tr> 
    </table> 
    <br> 

    <table> 
    <tr> 
    <td>Comments:    <br><input type="text" name="Commments"> <br></td> 
    </tr> 
    </table> 
    <br> 
    </div> 

    <input type="submit" align = "left" name="submit" value="Submit"/> 
    </table> 

    </form> 
    <br>     

    </div>
    Also, when this code is fixed, up and running, is there a place I can post it so that others can reference it should they be new and have this problem?

  4. #19
    Regular Coder
    Join Date
    Sep 2007
    Location
    Grahamstown, South Africa
    Posts
    237
    Thanks
    6
    Thanked 17 Times in 17 Posts
    Dont forget to actually connect to the database. Also, setting display errors might also help eg:

    //show errors
    PHP Code:

    ini_set
    ("display_errors""on"); 
    //connect to mssql database
    PHP Code:

    $server 
    'KALLESPC\SQLEXPRESS';

    // Connect to MSSQL
    $link mssql_connect($server'sa''phpfi');

    if (!
    $link) {
        die(
    'Something went wrong while connecting to MSSQL');
    }

    //Select DB 
    $dbn 'dbName'
    mssql_select_db($dbn); 
    Last edited by idalatob; 12-17-2012 at 03:55 PM.

  5. #20
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    Quote Originally Posted by idalatob View Post
    Fou-Lu doesnt take kindly to mistakes. :-P
    wrath++
    Please note as well that mssql package is not available for PHP5.3+.

  6. #21
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,281
    Thanks
    57
    Thanked 523 Times in 510 Posts
    Blog Entries
    5
    Quote Originally Posted by idalatob View Post
    Fou-Lu doesnt take kindly to mistakes. :-P
    Thats because he's a bl**dy good coder who knows his stuff. The better you become at coding the less tolerant you become with mistakes.
    See my new CodingForums Blog: http://www.codingforums.com/blogs/tangoforce/

    Many useful explanations and tips including: Cannot modify headers - already sent, The IE if (isset($_POST['submit'])) bug explained, unexpected T_CONSTANT_ENCAPSED_STRING, debugging tips and much more!

  7. #22
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    Quote Originally Posted by tangoforce View Post
    Thats because he's a bl**dy good coder who knows his stuff. The better you become at coding the less tolerant you become with mistakes.
    That's right! I'm [practically] perfect hehehe
    One day I'll actually start programming again. My skills are becoming a bit antiquated over the past few years.

  8. #23
    New Coder
    Join Date
    Aug 2012
    Posts
    65
    Thanks
    5
    Thanked 0 Times in 0 Posts
    okay, now it shows the error being thrown:
    Fatal error: Call to undefined function mssql_query() in C:\Inetpub\wwwroot\msag\enter.php on line 28

    PHP Code:
    <?php
    include 'includes/db/connect.php';
    ini_set("display_errors""on");

    /**
    First thing, we create a function that will make your data safe! 
    **/ 
    function mssql_escape($data) { 
        if(
    is_numeric($data)) 
            return 
    $data
        
    $unpacked unpack('H*hex'$data); 
        return 
    '0x' $unpacked['hex']; 


    if (isset(
    $_POST['LOWNUMBER'])) {
        
    //now we loop through the post data and sanitize it! 
        
    foreach ($_POST as $key=>$value) { 
            
    $_POST[$key] = mssql_escape($value); 
        } 
        
        
    //now we build the query! 
        
    $strSQL "INSERT INTO MSAG ";   
        
    $strSQL .="(StreetName) ";   
        
    $strSQL .="VALUES ";   
        
    $strSQL .= "({$_POST['StreetName']})"
        
        
    //now we insert it 
        
    mssql_query($strSQL);
    }
    ?>

    <?php include 'includes/head/head_main.php'?> 

    <div id = "top_content"> 
    <body> 

    <?php include 'includes/header/header_main.php'?> 

    <h1>Add New Record</h1> 

    <div id = "enter_record"> 

    </center> 
    <div id = "modify"> 



    <form action="" method="post" enctype="multipart/form-data"> 

    <table> 
    <tr> 
    <td>Pre Dir:    <br><input type="text" name="StreetPrefix"> <br></td> 
    <td>Street:     <br><input type="text" name="StreetName"> <br></td> 
    <td>Suffix:     <br><input type="text" name="StreetSuffix"> <br></td> 
    <td>Post Dir:     <br><input type="text" name="StreetPostDir"> <br></td> 
    <td>Community:     <br><input type="text" name="COMMUNITY"> <br></td> 
    </tr></table> 
    <br> 

    <table>  
    <tr> 
    <td>Low:    <br><input type="text" name="LOWNUMBER"> <br></td> 
    <td>High:    <br><input type="text" name="HighNumber"> <br></td> 
    <td>EOB:    <br><input type="text" name="EOB"> <br></td> 
    <td>ESN:    <br><input type="text" name="ESN"> <br></td> 
    </tr> 
    </table> 
    <br> 

    <table>  
    <tr> 
    <td>Telco:    <br><input type="text" name="TELCO"> <br></td> 
    <td>ZIP:    <br><input type="text" name="PostOffice"> <br></td> 
    <td>Zone:    <br><input type="text" name="ZONE"> <br></td> 
    <td>Map:    <br><input type="text" name="MAP"> <br></td> 
    </tr> 
    </table> 
    <br> 

    <table> 
    <tr> 
    <td>Entered:    <br><input type="text" name="DateEntered"> <br></td> 
    <td>Modified:    <br><input type="text" name="DateUpdated"> <br></td> 
    </tr> 
    </table> 
    <br> 

    <table> 
    <tr> 
    <td>Comments:    <br><input type="text" name="Commments"> <br></td> 
    </tr> 
    </table> 
    <br> 
    </div> 

    <input type="submit" align = "left" name="submit" value="Submit"/> 
    </table> 

    </form> 
    <br>     

    </div>
    P.S. You were correct that I forgot to include my connection.

    Also, I know this may be outside of this forums scope, but, Is PHP the best way to manipulate a database like this?

  9. #24
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    You'll need to use the SQLSrv or PDO packages. The mssql isn't available on 5.3+, which appears to likely be the case here (or its just disabled).

    You can use any language that's capable of external resource to manipulate a database. If you are looking for ease of use, then with SQLServer it would be easiest done using C# or VB.

  10. #25
    Senior Coder
    Join Date
    Nov 2010
    Posts
    1,368
    Thanks
    262
    Thanked 32 Times in 31 Posts
    Quote Originally Posted by tangoforce View Post
    Thats because he's a bl**dy good coder who knows his stuff. The better you become at coding the less tolerant you become with mistakes.
    So true i feel really bad about giving out wrong info like that, honestly i should be thanking willscarlet because i leaned today that there is such a thing as MsSQL, its the first i have heard of it and again i am so sorry. I have only dealt with MySql and i had terrible tunnel vision on this one. When i saw MsSQL i thought it was a typo on his part. Again sorry lol.. .

    Here is something i hope Fou-Lu and the rest of us will chuckle about, for the longest time (i dont know why) but until recently (a few weeks ago) i always thought Fou-Lu was a female lmao...

  11. #26
    New Coder
    Join Date
    Aug 2012
    Posts
    65
    Thanks
    5
    Thanked 0 Times in 0 Posts
    Fou, you are correct again. I remember having this issue in the very beggining when I started this project. I had to convert all the MySQL to sqlsrv for the most part. I did so, and had to add my $conn, variable to the query as well to clear a new error that arose. The new code now shows up, on the screen, when I hit submit, it refreshes the page (clearing the form data fields) but still is not inserting it into the database for some reason.

    code:
    PHP Code:
    <?php
    include 'includes/db/connect.php';
    ini_set("display_errors""on");

    /**
    First thing, we create a function that will make your data safe! 
    **/ 
    function mssql_escape($data) { 
        if(
    is_numeric($data)) 
            return 
    $data
        
    $unpacked unpack('H*hex'$data); 
        return 
    '0x' $unpacked['hex']; 


    if (isset(
    $_POST['LOWNUMBER'])) {
        
    //now we loop through the post data and sanitize it! 
        
    foreach ($_POST as $key=>$value) { 
            
    $_POST[$key] = mssql_escape($value); 
        } 
        
        
    //now we build the query! 
        
    $strSQL "INSERT INTO MSAG ";   
        
    $strSQL .="(StreetName) ";   
        
    $strSQL .="VALUES ";   
        
    $strSQL .= "({$_POST['StreetName']})"
        
        
    //now we insert it 
        
    sqlsrv_query($conn$strSQL);
    }
    ?>

    <?php include 'includes/head/head_main.php'?> 

    <div id = "top_content"> 
    <body> 

    <?php include 'includes/header/header_main.php'?> 

    <h1>Add New Record</h1> 

    <div id = "enter_record"> 

    </center> 
    <div id = "modify"> 



    <form action="" method="post" enctype="multipart/form-data"> 

    <table> 
    <tr> 
    <td>Pre Dir:    <br><input type="text" name="StreetPrefix"> <br></td> 
    <td>Street:     <br><input type="text" name="StreetName"> <br></td> 
    <td>Suffix:     <br><input type="text" name="StreetSuffix"> <br></td> 
    <td>Post Dir:     <br><input type="text" name="StreetPostDir"> <br></td> 
    <td>Community:     <br><input type="text" name="COMMUNITY"> <br></td> 
    </tr></table> 
    <br> 

    <table>  
    <tr> 
    <td>Low:    <br><input type="text" name="LOWNUMBER"> <br></td> 
    <td>High:    <br><input type="text" name="HighNumber"> <br></td> 
    <td>EOB:    <br><input type="text" name="EOB"> <br></td> 
    <td>ESN:    <br><input type="text" name="ESN"> <br></td> 
    </tr> 
    </table> 
    <br> 

    <table>  
    <tr> 
    <td>Telco:    <br><input type="text" name="TELCO"> <br></td> 
    <td>ZIP:    <br><input type="text" name="PostOffice"> <br></td> 
    <td>Zone:    <br><input type="text" name="ZONE"> <br></td> 
    <td>Map:    <br><input type="text" name="MAP"> <br></td> 
    </tr> 
    </table> 
    <br> 

    <table> 
    <tr> 
    <td>Entered:    <br><input type="text" name="DateEntered"> <br></td> 
    <td>Modified:    <br><input type="text" name="DateUpdated"> <br></td> 
    </tr> 
    </table> 
    <br> 

    <table> 
    <tr> 
    <td>Comments:    <br><input type="text" name="Commments"> <br></td> 
    </tr> 
    </table> 
    <br> 
    </div> 

    <input type="submit" align = "left" name="submit" value="Submit"/> 
    </table> 

    </form> 
    <br>     

    </div>

  12. #27
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    If you insert it as a flat sql string, you need to provide the proper datatypes: $strSQL .= "({$_POST['StreetName']})"; . Assuming that street name is a string, you need to change that into $strSQL .= "('{$_POST['StreetName']}')"; (although you will need to execute an escape sequence on it such as the one provided by idalatob). Personally I'd use the parameter's for the statement.
    You can verify that this is a datatype issue by executing the sqlsrv_query with an or die(print_r(sqlsrv_error(), true)); and inspecting the error.

    Edit:
    Quote Originally Posted by durangod View Post
    Here is something i hope Fou-Lu and the rest of us will chuckle about, for the longest time (i dont know why) but until recently (a few weeks ago) i always thought Fou-Lu was a female lmao...
    rofls

  13. #28
    New Coder
    Join Date
    Aug 2012
    Posts
    65
    Thanks
    5
    Thanked 0 Times in 0 Posts
    I thank you for taking the time to continue to help me figure this out, however, I fear I may be a tad too simple minded. Im am very confused about your last post sir. Im sure it was worded properly, I just dont quite understand. Yes sir, StreetName is a string, I am assuming that the fields that are not strings I would simply need to take the ' out of it? I did change my code to what i believe you said to, and the results are still the same (Page just refreshes, nothign added to the DB):

    PHP Code:
    <?php
    include 'includes/db/connect.php';
    ini_set("display_errors""on");

    /**
    First thing, we create a function that will make your data safe! 
    **/ 
    function mssql_escape($data) { 
        if(
    is_numeric($data)) 
            return 
    $data
        
    $unpacked unpack('H*hex'$data); 
        return 
    '0x' $unpacked['hex']; 


    if (isset(
    $_POST['LOWNUMBER'])) {
        
    //now we loop through the post data and sanitize it! 
        
    foreach ($_POST as $key=>$value) { 
            
    $_POST[$key] = mssql_escape($value); 
        } 
        
        
    //now we build the query! 
        
    $strSQL "INSERT INTO MSAG ";   
        
    $strSQL .="(StreetName) ";   
        
    $strSQL .="VALUES ";   
        
    $strSQL .= "('{$_POST['StreetName']}')";
        
        
    //now we insert it 
        
    sqlsrv_query($conn$strSQL) or die(print_r(sqlsrv_error(), true));
    }
    ?>

    <?php include 'includes/head/head_main.php'?> 

    <div id = "top_content"> 
    <body> 

    <?php include 'includes/header/header_main.php'?> 

    <h1>Add New Record</h1> 

    <div id = "enter_record"> 

    </center> 
    <div id = "modify"> 



    <form action="" method="post" enctype="multipart/form-data"> 

    <table> 
    <tr> 
    <td>Pre Dir:    <br><input type="text" name="StreetPrefix"> <br></td> 
    <td>Street:     <br><input type="text" name="StreetName"> <br></td> 
    <td>Suffix:     <br><input type="text" name="StreetSuffix"> <br></td> 
    <td>Post Dir:     <br><input type="text" name="StreetPostDir"> <br></td> 
    <td>Community:     <br><input type="text" name="COMMUNITY"> <br></td> 
    </tr></table> 
    <br> 

    <table>  
    <tr> 
    <td>Low:    <br><input type="text" name="LOWNUMBER"> <br></td> 
    <td>High:    <br><input type="text" name="HighNumber"> <br></td> 
    <td>EOB:    <br><input type="text" name="EOB"> <br></td> 
    <td>ESN:    <br><input type="text" name="ESN"> <br></td> 
    </tr> 
    </table> 
    <br> 

    <table>  
    <tr> 
    <td>Telco:    <br><input type="text" name="TELCO"> <br></td> 
    <td>ZIP:    <br><input type="text" name="PostOffice"> <br></td> 
    <td>Zone:    <br><input type="text" name="ZONE"> <br></td> 
    <td>Map:    <br><input type="text" name="MAP"> <br></td> 
    </tr> 
    </table> 
    <br> 

    <table> 
    <tr> 
    <td>Entered:    <br><input type="text" name="DateEntered"> <br></td> 
    <td>Modified:    <br><input type="text" name="DateUpdated"> <br></td> 
    </tr> 
    </table> 
    <br> 

    <table> 
    <tr> 
    <td>Comments:    <br><input type="text" name="Commments"> <br></td> 
    </tr> 
    </table> 
    <br> 
    </div> 

    <input type="submit" align = "left" name="submit" value="Submit"/> 
    </table> 

    </form> 
    <br>     

    </div>
    Last edited by willscarlet; 12-17-2012 at 04:34 PM.

  14. #29
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    No error tossed against the sqlsrv_error?
    Just looking at it I'd have to guess that the record itself cannot consist of just the StreetName. I can't tell for sure, but I would presume that you have more fields that are required for the insertion point, but I'd also expect that the sqlsrv_error would indicate that. Since it does not, it lends weight to the issue being that $_POST['LOWNUMBER'] isn't set. Looks to me that it is though. Make sure you are executing this script from scratch, not just refreshing and sending the same data.

    I'm not 100% sure that the quotes are required actually. This is a hex string going in, so it may want it as a number. But if that were the case you'd be limited to 32/64 bit in length as well, so that wouldn't make sense. I'd expect it would also throw an error in the die call.
    Wait I think I found it here. The error is actually sqlsrv_errors() with an 's' at the end. Make sure you open the error reporting up with error_reporting(E_ALL); that should have thrown an undefined function error.

  15. #30
    New Coder
    Join Date
    Aug 2012
    Posts
    65
    Thanks
    5
    Thanked 0 Times in 0 Posts
    I turned on the errors and all, but still not recieving an error, Page is still simply refreshing itself:

    In my isset, what is the purpose of having LOWNUMBER in that spot? I tried replacing it with StreetName, but still the same results.

    PHP Code:
    <?php
    include 'includes/db/connect.php';

    error_reporting(E_ALL); 
    ini_set("display_errors""on");

    /**
    First thing, we create a function that will make your data safe! 
    **/ 
    function mssql_escape($data) { 
        if(
    is_numeric($data)) 
            return 
    $data
        
    $unpacked unpack('H*hex'$data); 
        return 
    '0x' $unpacked['hex']; 


    if (isset(
    $_POST['LOWNUMBER'])) {
        
    //now we loop through the post data and sanitize it! 
        
    foreach ($_POST as $key=>$value) { 
            
    $_POST[$key] = mssql_escape($value); 
        } 
        
        
    //now we build the query! 
        
    $strSQL "INSERT INTO MSAG ";   
        
    $strSQL .="(StreetName) ";   
        
    $strSQL .="VALUES ";   
        
    $strSQL .= "('{$_POST['StreetName']}')";
        
        
    //now we insert it 
        
    sqlsrv_query($conn$strSQL) or die(print_r(sqlsrv_errors(), true));
    }
    ?>

    <?php include 'includes/head/head_main.php'?> 

    <div id = "top_content"> 
    <body> 

    <?php include 'includes/header/header_main.php'?> 

    <h1>Add New Record</h1> 

    <div id = "enter_record"> 

    </center> 
    <div id = "modify"> 



    <form action="" method="post" enctype="multipart/form-data"> 

    <table> 
    <tr> 
    <td>Pre Dir:    <br><input type="text" name="StreetPrefix"> <br></td> 
    <td>Street:     <br><input type="text" name="StreetName"> <br></td> 
    <td>Suffix:     <br><input type="text" name="StreetSuffix"> <br></td> 
    <td>Post Dir:     <br><input type="text" name="StreetPostDir"> <br></td> 
    <td>Community:     <br><input type="text" name="COMMUNITY"> <br></td> 
    </tr></table> 
    <br> 

    <table>  
    <tr> 
    <td>Low:    <br><input type="text" name="LOWNUMBER"> <br></td> 
    <td>High:    <br><input type="text" name="HighNumber"> <br></td> 
    <td>EOB:    <br><input type="text" name="EOB"> <br></td> 
    <td>ESN:    <br><input type="text" name="ESN"> <br></td> 
    </tr> 
    </table> 
    <br> 

    <table>  
    <tr> 
    <td>Telco:    <br><input type="text" name="TELCO"> <br></td> 
    <td>ZIP:    <br><input type="text" name="PostOffice"> <br></td> 
    <td>Zone:    <br><input type="text" name="ZONE"> <br></td> 
    <td>Map:    <br><input type="text" name="MAP"> <br></td> 
    </tr> 
    </table> 
    <br> 

    <table> 
    <tr> 
    <td>Entered:    <br><input type="text" name="DateEntered"> <br></td> 
    <td>Modified:    <br><input type="text" name="DateUpdated"> <br></td> 
    </tr> 
    </table> 
    <br> 

    <table> 
    <tr> 
    <td>Comments:    <br><input type="text" name="Commments"> <br></td> 
    </tr> 
    </table> 
    <br> 
    </div> 

    <input type="submit" align = "left" name="submit" value="Submit"/> 
    </table> 

    </form> 
    <br>     

    </div>


 
Page 2 of 4 FirstFirst 1234 LastLast

Posting Permissions

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