|
 |
|
ต้องการ insert ข้อมูลเข้าแล้วเอา id ออกมาเพื่อ insert เก็บอีก table ต้องทำยังไงคะ |
|
 |
|
|
 |
 |
|
Code (PHP)
if ($file_type=="application/pdf" || $file_type=="image/gif" || $file_type=="image/jpeg") {
if(move_uploaded_file($_FILES['name_file']['tmp_name'], $targetfolder)){
$filename = $_FILES['name_file']['name'];
$time= date('Y-m-d H:i:s');
$sql="insert into complain(topic,topic_to,name_file,id_user,name_user,position,
dept,subject,detailsub,detail,create_by,create_date,IP_create)
values('$_POST[topic]','$_POST[topic_to]','$filename','$_POST[id_user]','$_POST[name_user]',
'$_POST[position]','$_POST[dept]','$_POST[subject]','$_POST[detailsub]','$_POST[detail]',
'$_POST[id_user]','$time','$ip')";
$query = odbc_exec($link,$sql);
/* $sql1 = "select * From complain where id = '$id' ";
$query1 = odbc_exec ($link,$sql1);
$row = odbc_fetch_array($query1);
echo $row['id'];*/
//$sql2 = "insert into complain_att(attached,id_com) values('$filename','$id');";
//$query2 = odbc_exec($link,$sql2);
?>
<script>
alert('ข้อมูลถูกบันทึกเรียบร้อยแล้ว');
//return false;
</script>
<?php
//echo " The file ". basename( $_FILES['name_file']['name']). " is uploaded ";
}else {
echo "Problem uploading file";
}
}else {
//echo "You may only upload PDFs, JPEGs or GIF files.<br>";
}
ขอสอบถามอีกข้อ คือ input ข้อมูลเข้าdatabase เป็นภาษาต่างด้าว แต่พอ select ออกมาเป็นภาษาไทย


Tag : PHP, MySQL, Ms SQL Server 2008, Google Chrome, XAMPP, Windows

|
|
 |
 |
 |
 |
Date :
2019-02-11 09:29:52 |
By :
mewhappy |
View :
1002 |
Reply :
1 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
|
|

|
Load balance : Server 01
|