Advertisement
Guest User

Untitled

a guest
Oct 6th, 2016
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. <?php
  2. $dbhost = "localhost";
  3. $username = "root";
  4. $pass = "";
  5. $conn = mysql_connect("$dbhost" , "$username" , "$pass");
  6. if(!$conn)
  7. {
  8. die("connection failed : ". mysqli_connect_error());
  9. }
  10. else{
  11. echo "Database connected Successfully!!!";
  12. }
  13. $db = mysql_select_db("table1",$conn);
  14. //$sql = "SELECT * from table1 WHERE id = 1";
  15. $sql = "INSERT INTO table1 (ID, Name,Designation) Designation)VALUES(NULL,'abhishek','Student')";
  16. $query = mysql_query($conn , $sql);
  17. ?>
  18.  
  19. Database connected Successfully!!!
  20. Warning: mysql_query() expects parameter 1 to be string, resource given in C:xampphtdocsTestDatabase1.php on line 16
  21.  
  22. $sql = "INSERT INTO table1 (ID, Name,Designation) Designation)VALUES(NULL,'abhishek','Student')";
  23.  
  24. $sql = "INSERT INTO table1 (ID, Name,Designation) VALUES(NULL,'abhishek','Student')";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement