Câu lệnh MySQL sau đây sẽ trả về các “cate_id” duy nhất, dưới dạng danh sách các chuỗi được phân tách bằng dấu phân cách được chỉ định '' [dấu cách] theo thứ tự tăng dần cho mỗi nhóm 'pub_id' từ bảng book_mast. Có thể thay đổi thứ tự giảm dần, sử dụng tùy chọn 'DESC' thay vì 'ASC' ở cuối câu lệnh chọn
Tôi đang cố viết if trong truy vấn mysql. Dựa trên. http. // nhà phát triển. mysql. com/doc/refman/5. 0/. bản tường trình. htmlTôi đã nghĩ ra điều này, nhưng không có niềm vui
mysql_query["UPDATE skew_trkg_slave IF observations_needed = observations_completed THEN SET minor_cycle_completed = '1';WHERE " . $skew_trkg_slave_where . ""] or die[mysql_error[]];
Tôi gần đến mức nào?
Được chỉnh sửa vào ngày 24 tháng 12 năm 2011 bởi nicheLiên kết để bình luậnChia sẻ trên các trang web khác
chỉ là một vài anh chàng
Đăng ngày 23 tháng 12 năm 2011
chỉ là một vài anh chàng
- người điều hành
- 31. 6k
- Vị trí. Phượng hoàng
- Ngôn ngữ. Tập trung vào PHP và JavaScript
- Chia sẻ
Đăng ngày 23 tháng 12 năm 2011
Tham chiếu bạn đã liên kết đến là dành cho các hàm, không phải truy vấn SQL. Đây là cho các truy vấn. http. // nhà phát triển. mysql. com/doc/refman/5. 0/vi/chức năng luồng điều khiển. html#function_if Câu lệnh if trả về một giá trị, vì vậy giá trị đó sẽ là giá trị để trường cập nhật. e. g. CẬP NHẬT bảng SET trường = IF[. ] Ở ĐÂU
mysql_query doesnt support multiple queries, a way round this is to use innodb and transactions
this db class/function will accept an array of arrays of querys, it will auto check every line for affected rows in db, if one is 0 it will rollback and return false, else it will commit and return true, the call to the function is simple and is easy to read etc
----------
class MySQLDB
{
private $connection; // The MySQL database connection
/* Class constructor */
function MySQLDB[]{
/* Make connection to database */
$this->connection = mysql_connect[DB_SERVER, DB_USER, DB_PASS] or die[mysql_error[]];
mysql_select_db[DB_NAME, $this->connection] or die[mysql_error[]];
}
/* Transactions functions */
function begin[]{
$null = mysql_query["START TRANSACTION", $this->connection];
return mysql_query["BEGIN", $this->connection];
}
function commit[]{
return mysql_query["COMMIT", $this->connection];
}
________số 8
function transaction[$q_array]{
$retval = 1;
mysql_query doesnt support multiple queries, a way round this is to use innodb and transactions
0
this db class/function will accept an array of arrays of querys, it will auto check every line for affected rows in db, if one is 0 it will rollback and return false, else it will commit and return true, the call to the function is simple and is easy to read etc
0
----------
this db class/function will accept an array of arrays of querys, it will auto check every line for affected rows in db, if one is 0 it will rollback and return false, else it will commit and return true, the call to the function is simple and is easy to read etc
1
----------
this db class/function will accept an array of arrays of querys, it will auto check every line for affected rows in db, if one is 0 it will rollback and return false, else it will commit and return true, the call to the function is simple and is easy to read etc
2
----------
this db class/function will accept an array of arrays of querys, it will auto check every line for affected rows in db, if one is 0 it will rollback and return false, else it will commit and return true, the call to the function is simple and is easy to read etc
3
----------
this db class/function will accept an array of arrays of querys, it will auto check every line for affected rows in db, if one is 0 it will rollback and return false, else it will commit and return true, the call to the function is simple and is easy to read etc
4
----------
this db class/function will accept an array of arrays of querys, it will auto check every line for affected rows in db, if one is 0 it will rollback and return false, else it will commit and return true, the call to the function is simple and is easy to read etc
5
----------
this db class/function will accept an array of arrays of querys, it will auto check every line for affected rows in db, if one is 0 it will rollback and return false, else it will commit and return true, the call to the function is simple and is easy to read etc
6
----------
this db class/function will accept an array of arrays of querys, it will auto check every line for affected rows in db, if one is 0 it will rollback and return false, else it will commit and return true, the call to the function is simple and is easy to read etc
7
----------
this db class/function will accept an array of arrays of querys, it will auto check every line for affected rows in db, if one is 0 it will rollback and return false, else it will commit and return true, the call to the function is simple and is easy to read etc
8
----------