summaryrefslogtreecommitdiffstats
path: root/Website/insert.php
blob: dbcec31e4ab5e194e3c571976b62ad9d9e0fc3ab (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php
	$con = mysql_connect("localhost","root","mysqlroot11");
	if (!$con) {
?> 		<p>There is something wrong about your connection to database!</p>
<?php   }

	mysql_select_db("gsmselftesting", $con);
	
	if(!empty($_POST)) {
		
		if($_POST["sip_gsmrz1"]) {
			
			$query1 = "INSERT INTO `TaskTable` (`taskNo`, `from`, `to`) VALUES(5, 'sip', 'gsmRZ1')";
			$result1 = mysql_query($query1);
			$query2 = "SELECT @taskID := LAST_INSERT_ID()";
			$result2 = mysql_query($query2);
			$query3 = "INSERT INTO `TempTaskTable` (`taskID`, `taskNo`, `from`, `to`) VALUES(@taskID, 5, 'sip', 'gsmRZ1')";
			$result3 = mysql_query($query3);
			
			if(!$result1 || !$result2 || !$result3){
				die('Invalid query: ' . mysql_error());
			}
			else {
?>				<p> Relevant information was put in the database! </p>
<?php                   }        
		}
	}
	mysql_close($con)
?>