|
 |
|
สอบถามปัญหาคำสั่ง insert into เวลา insert ไปแล้วจะขึ้นข้อมูลมา2แถวครับ แถวแรกมีข้อมูล แถวที่สองมีแต่ข้อมูลวันที่ปัจจุบัน ต้องแก้อย่างไรครับ |
|
 |
|
|
 |
 |
|
คือ พอกดปุ่ม submit จาก form มาแล้ว จะเข้าโค้ดนี้น่ะครับ
Code (PHP)
$host="localhost";
$user="user";
$pw="pwd";
$dbname="dbname";
$c=mysql_connect($host,$user,$pw);
if(!$c){
echo "<h2>No connect</h2>";
exit();
}
$topic=$_POST['topic'];
$biz=$_POST['biz'];
$education=$_POST['education'];
$number=$_POST['number'];
$property=$_POST['property'];
$place=$_POST['place'];
$salary=$_POST['salary'];
$jobtime=$_POST['jobtime'];
$today_date=date("Y-m-d");
include "code/function.php";
$iplog=getIP();//รับip
$userid=$_SESSION['u_id'];
$sql="INSERT INTO `jobs_topic` (`t_id` ,`t_topic` ,`t_biztype` ,`t_num` ,`t_education` ,`t_property` ,`t_place` ,`t_salary` ,`t_jobtime` ,`t_date`, `t_ip`,`u_id`)VALUES (NULL , '$topic', '$biz', '$number', '$education', '$property', '$place', '$salary', '$jobtime', '$today_date','$iplog', '$userid')";
mysql_query("SET NAMES UTF8");
$result=mysql_db_query($dbname,$sql);
$c=mysql_close();
แล้วพอ เพิ่มค่าเรียบร้อยแล้ว ไปดูในlocalhost จะขึ้นมา สองแถวครับ
แถวแรก มีข้อมูลตามท่ใส่ใน form ครับ
แถวที่สอง จะมีข้อมูลขึ้นมากแค่ วันที่ปัจจุบัน กับ ip ครับ
ผมอยากให้มันขึ้นมาแค่แถวแรกน่ะครับ
Tag : PHP

|
|
 |
 |
 |
 |
Date :
2011-05-25 10:04:51 |
By :
marauder |
View :
836 |
Reply :
1 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
เอาแถว mysql_query("SET NAMES UTF8"); อยู่ข้างบนครับ
Code (PHP)
mysql_query("SET NAMES UTF8");
$sql="INSERT INTO `jobs_topic` (`t_id` ,`t_topic` ,`t_biztype` ,`t_num` ,`t_education` ,`t_property` ,`t_place` ,`t_salary` ,`t_jobtime` ,`t_date`, `t_ip`,`u_id`)VALUES (NULL , '$topic', '$biz', '$number', '$education', '$property', '$place', '$salary', '$jobtime', '$today_date','$iplog', '$userid')";
|
 |
 |
 |
 |
Date :
2011-05-25 10:33:02 |
By :
prach_kp |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 03
|