Table data insert : Database Insert « MySQL Database « PHP






Table data insert

<?php
   mysql_connect("mysql153.secureserver.net","java2s","password");
   mysql_select_db("java2s");

      $id = "12";
      $name = "Joe";

      $query = "INSERT INTO Employee SET id='$id', name='$name'";
      $result = mysql_query($query);

      // Display an appropriate message
      if ($result) 
         echo "<p>Product successfully inserted!</p>";
      else 
         echo "<p>There was a problem inserting the Employee!</p>";

      mysql_close();
?>


           
       








Related examples in the same category

1.Use form to add data to database
2.Adding a Row to a Table