差不多可以給大家試用了..
這個Library是給PHP用的,用於對MySQL的資料庫操作
Google Code: http://code.google.com/p/php-mysql-like-ror/
mysql.php: 這個是MySQL的物件,包含了基礎操作:連線、查詢、傳回結果、關閉連線
php_mysql_like_ror.php: 這個是行為操作,有find_all, find_all_by_field, create, update_field, update_fields, delete_by
common_functions.php: 這邊是給php_mysql_like_ror.php呼叫用的輔助函式
以下是操作範例:
require 'php_mysql_like_ror.php';
$mysql = new MySQL("localhost", "cfc", "cfc", "wtf"); // Default encoding is UTF-8
$mysql->Conn();
$mysql->Exec(find_all_by_field("id", 10, "users")); // Same as: mysql_query("SELECT * FROM `users` WHERE id = 10");
// Same as: mysql_fetch_assoc(mysql_query("SELECT * FROM `users` WHERE id BETWEEN 10 AND 20 LIMIT 5"));
$mysql->fetch_assoc(find_all("users", array("conditions" => "id BETWEEN 10 AND 20", "limit" => 5)));
$mysql->getCount(find_all("users", array("select" => "id"))); // Same as: mysql_num_rows(mysql_query("SELECT id FROM `users`"));
$mysql->Close();
$mysql = null;
如果有發現bugs或者有任何建議或者是features建議的,請到http://code.google.com/p/php-mysql-like-ror/issues/list 丟issues給我們,謝謝
原始碼在這邊: http://code.google.com/p/php-mysql-like-ror/source/list
可以用SVN來追我們的trunk:
svn checkout http://php-mysql-like-ror.googlecode.com/svn/trunk/ php-mysql-like-ror
有新的Update我會在Blog上另闢新文的:D
創作者介紹

卐只有兩面的盒子卍

hechian 發表在 痞客邦 PIXNET 留言(0) 人氣()