-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhaksadbtest.php
42 lines (35 loc) · 1006 Bytes
/
haksadbtest.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
39
40
41
42
<?php
/*** mysql hostname ***/
$hostname = 'localhost';
/*** mysql username ***/
$username = 'haksauser';
/*** mysql password ***/
$password = 'haksapass';
try {
$dbh = new PDO("mysql:host=$hostname;dbname=haksa", $username, $password);
/*** echo a message saying we have connected ***/
echo 'Connected to database<br />';
/*** INSERT data ***/
$userid='A99888';
$usertype='s';
$pwd='123456';
$username='kim';
$surname='jjj';
$firstname='kkkk';
$email='ksjsj';
$hp='1234777';
$grade='4';
$clscode='hhhhh';
$sql2="INSERT INTO haksa(userid,usertype,pwd,surname,firstname,email,hp,grade,clscode) VALUES (?,?,?,?,?,?,?,?,?)";
$q=$dbh->prepare($sql2);
$count=$q->execute(array($userid,$usertype,$pwd,$surname,$firstname,$email,$hp,$grade,$clscode));
/*** echo the number of affected rows ***/
echo $count;
/*** close the database connection ***/
$dbh = null;
}
catch(PDOException $e)
{
echo $e->getMessage();
}
?>