summaryrefslogtreecommitdiffstats
path: root/Website/insert.php
diff options
context:
space:
mode:
Diffstat (limited to 'Website/insert.php')
-rw-r--r--Website/insert.php46
1 files changed, 27 insertions, 19 deletions
diff --git a/Website/insert.php b/Website/insert.php
index 1d7ef8f..dbcec31 100644
--- a/Website/insert.php
+++ b/Website/insert.php
@@ -1,21 +1,29 @@
<?php
-$con = mysql_connect("localhost","peter","abc123");
-if (!$con)
- {
- die('Could not connect: ' . mysql_error());
- }
+ $con = mysql_connect("localhost","root","mysqlroot11");
+ if (!$con) {
+?> <p>There is something wrong about your connection to database!</p>
+<?php }
-mysql_select_db("my_db", $con);
-
-$sql="INSERT INTO temptasktable (FirstName, LastName, Age)
-VALUES
-('$_POST[from]','$_POST[destination]','$_POST[timestamp]')";
-
-if (!mysql_query($sql,$con))
- {
- die('Error: ' . mysql_error());
- }
-echo "1 record added";
-
-mysql_close($con)
-?> \ No newline at end of file
+ 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)
+?>