Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $host="localhost"; // Host name
- $username="root"; // Mysql username
- $password="admin"; // Mysql password
- $db_name="test"; // Database name
- $tbl_name="petenci"; // Table name
- $imie=$_POST['imie'];
- $nazwisko=$_POST['nazwisko'];
- $indeks=$_POST['indeks'];
- // Connect to server and select database.
- mysql_connect("$host", "$username", "$password")or die("cannot connect server ");
- mysql_select_db("$db_name")or die("cannot select DB");
- $sql="INSERT INTO $tbl_name(imie, nazwisko,indeks) VALUES('$imie', '$nazwisko', '$indeks')";
- $result=mysql_query($sql);
- //check if query successful
- if($result){
- echo "DODANO";
- }
- else {
- echo "ERROR";
- }
- mysql_close();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement