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
42
<?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());
$taskName = mysqli_real_escape_string($_POST['dtaskname']);
$descName = mysqli_real_escape_string($_POST['dtaskdescr']);
$funcZone = mysqli_real_escape_string($_POST['dzonecheck']);
$testType = mysqli_real_escape_string($_POST['dtypetesting']);
$testBrow = mysqli_real_escape_string($_POST['dbrowser']);
$testPlat = mysqli_real_escape_string($_POST['dplatform']);
$siteName = mysqli_real_escape_string($_POST['dsitename']);
$loctName = mysqli_real_escape_string($_POST['dcountry']);
$devlName = mysqli_real_escape_string($_POST['rdev']);
$rdmTskid = mysqli_real_escape_string($_POST['rredmine']);
$qaName = mysqli_real_escape_string($_POST['rqa']);
$pmName = mysqli_real_escape_string($_POST['rpm']);
$result = mysql_query("INSERT INTO '$dbtable' ('dbdateadd', 'dbtaskname', 'dbtaskdescr', 'dbzonecheck', 'dbtypetesting', 'dbbrowser', 'dbplatform ', 'dbsitename', 'dbcountry', 'dbqa', 'dbpm', 'dbdev', 'dbredmine') VALUES(NOW(), '$taskName', '$descName', '$funcZone', '$testType',
'$testBrow', '$testPlat', '$siteName', '$loctName', '$qaName', '$pmName', '$devlName', '$rdmTskid')");
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>");
?>