Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $dbhost = "localhost";
- $username = "root";
- $pass = "";
- $conn = mysql_connect("$dbhost" , "$username" , "$pass");
- if(!$conn)
- {
- die("connection failed : ". mysqli_connect_error());
- }
- else{
- echo "Database connected Successfully!!!";
- }
- $db = mysql_select_db("table1",$conn);
- //$sql = "SELECT * from table1 WHERE id = 1";
- $sql = "INSERT INTO table1 (ID, Name,Designation) Designation)VALUES(NULL,'abhishek','Student')";
- $query = mysql_query($conn , $sql);
- ?>
- Database connected Successfully!!!
- Warning: mysql_query() expects parameter 1 to be string, resource given in C:xampphtdocsTestDatabase1.php on line 16
- $sql = "INSERT INTO table1 (ID, Name,Designation) Designation)VALUES(NULL,'abhishek','Student')";
- $sql = "INSERT INTO table1 (ID, Name,Designation) VALUES(NULL,'abhishek','Student')";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement