-
Notifications
You must be signed in to change notification settings - Fork 0
/
add.php
38 lines (32 loc) · 1.41 KB
/
add.php
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
<?php
//--------------------------------------------------------------------------
// Example php script for fetching data from mysql database
//--------------------------------------------------------------------------
$host = "localhost";
$user = "root";
$pass = "";
$databaseName = "webinse_task";
$tableName = "test_table";
$fname = $_POST['fname'];
$sname = $_POST['sname'];
$email = $_POST['email'];
//--------------------------------------------------------------------------
// 1) Connect to mysql database
//--------------------------------------------------------------------------
//include 'DB.php';
$con = mysql_connect($host,$user,$pass);
$dbs = mysql_select_db($databaseName, $con);
//--------------------------------------------------------------------------
// 1) Connect to mysql database
//--------------------------------------------------------------------------
//include 'DB.php';
$con = mysql_connect($host,$user,$pass);
$dbs = mysql_select_db($databaseName, $con);
echo $link;
//--------------------------------------------------------------------------
// 2) Query database for data
//--------------------------------------------------------------------------
$result = mysql_query("INSERT INTO $tableName (First_name, Second_name, E_mail) VALUES ('$fname', '$sname', '$email')"); //query
$result = mysql_insert_id();
echo $result;
?>