update preferences
This commit is contained in:
@@ -23,18 +23,17 @@ long WrenchAccountSetPrefrence(CVars in, CVars &out){
|
||||
|
||||
try {
|
||||
long member_id = REQ_LONG(in, "member_id", 1, -1);
|
||||
REQ_STRING(in, "user_pref", 5, 15, "(.*)");
|
||||
out["total_record"] = "0";
|
||||
const PGresult *res;
|
||||
res = pgsql_query("SELECT * FROM members WHERE id = %lu", member_id );
|
||||
res = pgsql_query("SELECT id,uid FROM members WHERE id = %lu", member_id );
|
||||
|
||||
if (res != NULL && pgsql_num_rows(res) > 0) {
|
||||
out["total_record"] = pgsql_num_rows(res);
|
||||
map<const char*, const char*>f = pgsql_fetch_assoc(res,0);
|
||||
CVars rec;
|
||||
map_to_cvars(f, rec);
|
||||
|
||||
|
||||
|
||||
pgsql_query("UPDATE members SET account_pref='%s' WHERE id = %lu AND uid = '%s'",in["member_id"].Long(), rec["uid"].c_str());
|
||||
}
|
||||
|
||||
ret = PHP_API_OK;
|
||||
|
||||
Reference in New Issue
Block a user