|
|
|
ช่วยเขียนโค้ดอับเดทสองตารางให้ผมหน่อยนะครับ php mysql update |
|
|
|
|
|
|
|
เขียน 2 Query ครับ
Code (PHP)
$strSQL1 = "UPDATE ...";
mysql_query($strSQL1);
$strSQL2 = "UPDATE ...";
mysql_query($strSQL2);
|
|
|
|
|
Date :
2012-01-04 20:37:18 |
By :
webmaster |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ขอบคุณมากครับ ตอนนี้อับเดทได้แล้วครับ
แต่มันจะอับเดทแค่คนสุดท้าย อยากได้วิธีทำให้อับเดทได้หมดครับ ขอบคุณมากครับ
|
|
|
|
|
Date :
2012-01-05 15:14:56 |
By :
kamol01 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
เอา Query ของคุณมาดูครับ
|
|
|
|
|
Date :
2012-01-05 15:18:54 |
By :
webmaster |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (PHP)
$username = $_POST['username'];
$password = $_POST['password'];
$nickname = $_POST['nickname'];
$email = $_POST['email'];
$telephone = $_POST['telephone'];
$packagename = $_POST['packagename'];
$timeuse = $_POST['timeuse'];
$start = $_POST['start'];
$end = $_POST['end'];
$port = $_POST['port'];
$drive = $_POST['drive'];
$status = $_POST['status'];
$dbhostname = "localhost";
$dbusername = "root";
$dbpassword = "1111";
$dbname = "server";
$conn = mysql_connect($dbhostname, $dbusername, $dbpassword) or die (mysql_error());
$db = mysql_select_db($dbname, $conn) or die ("Cannot select DB");
mysql_query("SET NAMES TIS620");
$sql1 = "update user set user.username ='$username', user.password ='$password', user.nickname ='$nickname' , user.email ='$email', user.telephone ='$telephone' where user.username='$username'";
$sql2 = "update purchase set purchase.username ='$username', purchase.packagename ='$packagename', purchase.timeuse ='$timeuse', purchase.start ='$start', purchase.end ='$end', purchase.port ='$port', purchase.drive ='$drive', purchase.status ='$status' where purchase.username='$username'";
mysql_query($sql1);
mysql_query($sql2);
mysql_close($conn);
|
|
|
|
|
Date :
2012-01-05 15:21:07 |
By :
kamol01 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (PHP)
$sql1 = "update user set user.username ='$username', user.password ='$password', user.nickname ='$nickname' , user.email ='$email', user.telephone ='$telephone' where user.username='$username'";
mysql_query($sql1) or die(mysql_error());
$sql2 = "update purchase set purchase.username ='$username', purchase.packagename ='$packagename', purchase.timeuse ='$timeuse', purchase.start ='$start', purchase.end ='$end', purchase.port ='$port', purchase.drive ='$drive', purchase.status ='$status' where purchase.username='$username'";
mysql_query($sql2) or die(mysql_error());
ถ้าไม่ Error แสดงว่าค่า ตรง where ไม่ถูกต้องครับ
|
|
|
|
|
Date :
2012-01-06 12:56:01 |
By :
webmaster |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 01
|