01.
$strSQL
=
"SELECT * FROM detail"
;
02.
$objQuery
= mssql_query(
$strSQL
)
or
die
(
"Error Query ["
.
$strSQL
.
"]"
);
03.
$strSQL
=
"INSERT INTO detail"
;
04.
$strSQL
.=
"(ThaiName)"
;
05.
$strSQL
.=
"VALUES "
;
06.
$strSQL
.=
"('"
.
$_POST
[
"text_name"
].
"') "
;
07.
$strSQL
=
"SELECT @@IDENTITY AS last_id;"
;
08.
$objQuery
= mssql_query(
$strSQL
,
$your_link_identifier
);
09.
$rows
= mssql_fetch_assoc(
$result
);
10.
$last_id
=
$rows
[
"last_id"
];
11.
12.
$strSQL
=
"SELECT * FROM tel"
;
13.
$objQuery
= mssql_query(
$strSQL
)
or
die
(
"Error Query ["
.
$strSQL
.
"]"
);
14.
$strSQL
=
"INSERT INTO tel"
;
15.
$strSQL
.=
"(tel,ThaiName,id_detail)"
;
16.
$strSQL
.=
"VALUES "
;
17.
$strSQL
.=
"('"
.
$_POST
[
"text_tel"
].
"','"
.
$_POST
[
"text_name"
].
"','"
.
$_POST
[
"text_id_detail"
].
"') "
;
18.
$objQuery
= mssql_query(
$strSQL
);