Click here to Skip to main content
15,889,877 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi I am new in php. I could not insert the data into mysql table. and there is no error prompt Below is my code. Pls help me.

PHP
<?php
include_once '../inc/header.php';
if (isset($_POST['submit']) && $_POST['submit']  != "" )
    {
        $name = $_POST["name"];
        $address = $_POST["address"];
        $tel = $_POST["tel"];
        $fax = $_POST["fax"];
        $email = $_POST["email"];
        $website = $_POST["website"];
        $type = $_POST["type"];    
        try 
            { 
                $sql="INSERT INTO bk_customer (id,name,address,tel,fax,email,type,website)
                      VALUES ('$name','$address','$tel','$fax','$email','$website','$type')";
                $result = mysqli_query($con,$sql) ; 
                
           
            exit();
            } 
        catch (Exception $ex) 
            {
               echo $e->getMessage() . "\n";
               file_put_contents('PDOErrors.txt', $e->getMessage(), FILE_APPEND);
               exit();            
            }
     }
mysqli_close($con);
?>
Posted
Comments
Member 10641779 7-Apr-14 8:09am    
Dont use id in your query if you are not giving its value.
Maideen Abdul Kader 7-Apr-14 10:08am    
yes. Thank you

After remove id, works fine...
EZW 8-Apr-14 21:57pm    
In addition, you got website and type mixed around.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900