php file for insert data into mysql DB require dbconfig php Listing of

 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
30
31
32
33
34
35
36
37
38
39
40
41
<?php
// file for insert data into mysql DB
require 'dbconfig.php';
/* Listing of dbconfig.php
<?php
//MySQL connect details
$host = "somehost.com";
$user = "someuser";
$password = "somepassword";
$db = "somedb";
$dbtable = "sometable";
?>
*/
mysql_connect($host, $user, $password) or die (mysql_error());
mysql_select_db($db) or die (mysql_error());
$taskname1= mysqli_real_escape_string ($_POST['dtaskname']);
$descrname1= mysqli_real_escape_string ($_POST['dtaskdescr']);
$zone2= mysqli_real_escape_string ($_POST['dzonecheck']);
$type2= mysqli_real_escape_string ($_POST['dtypetesting']);
$brow2= mysqli_real_escape_string ($_POST['dbrowser']);
$plat2= mysqli_real_escape_string ($_POST['dplatform']);
$site2= mysqli_real_escape_string ($_POST['dsitename']);
$coun2= mysqli_real_escape_string ($_POST['dcountry']);
$qa3= mysqli_real_escape_string ($_POST['rqa']);
$pm3= mysqli_real_escape_string ($_POST['rpm']);
$dev3= mysqli_real_escape_string ($_POST['rdev']);
$redm3= mysqli_real_escape_string ($_POST['rredmine']);
$result = mysql_query("INSERT INTO '$dbtable' ('dbdateadd', 'dbtaskname', 'dbtaskdescr', 'dbzonecheck', 'dbtypetesting', 'dbbrowser', 'dbplatform ', 'dbsitename', 'dbcountry', 'dbqa', 'dbpm', 'dbdev', 'dbredmine') VALUES(NOW(), 'taskname1', 'descrname1', 'zone2', 'type2', 'brow2', 'plat2', 'site2', 'coun2', 'qa3', 'pm3', 'dev3', 'redm3')");
mysql_query($result) or die(mysql_error());
mysql_close();
echo ("<div style=\"text-align: center; margin-top: 10px;\">
<font color=\"green\">Saved!</font>
<a href=\"index.html\">Back to main</a></div>");
?>