fix query

This commit is contained in:
CHIEFSOFT\ameye
2024-01-23 12:11:01 -05:00
parent 3e1004693d
commit 475424cda6
+5 -3
View File
@@ -129,7 +129,7 @@ long WrenchFamilyInviteList(CVars in, CVars &out){
res = pgsql_query("SELECT * "
" FROM members_family_relative "
" WHERE member_id = %lu ) "
" AND sg.status IN ( 1,2,3,4,5) "
" AND status IN ( 1,2,3,4,5) "
" ORDER BY id DESC ", member_id );
if (res != NULL && pgsql_num_rows(res) > 0) {
@@ -153,6 +153,9 @@ long WrenchFamilyInviteList(CVars in, CVars &out){
snprintf(vname, sizeof (vname), "email_%05d", i);
out[vname] = rec["email"];
snprintf(vname, sizeof (vname), "status_%05d", i);
out[vname] = rec["status"];
snprintf(vname, sizeof (vname), "family_type_%05d", i);
out[vname] = rec["family_type"];
@@ -182,9 +185,8 @@ long WrenchFamilyInvite(CVars in, CVars &out){
out["invite_id"] ="0";// we will set if all okay
// const PGresult *res = pgsql_query("SELECT id FROM members_family_relative "
// " WHERE LOWER('%s') = LOWER(email) AND member_id= %lu", in["email"].c_str(), member_id);
if ( load_db_record(out, "SELECT id FROM members_family_relative "
if ( load_db_record(out, "SELECT count(id) AS prev_entry FROM members_family_relative "
" WHERE LOWER('%s') = LOWER(email) AND member_id= %lu", in["email"].c_str(), member_id)== 0){
// if (res != NULL && pgsql_num_rows(res) == 0 ) {
CVars xx;
xx["member_id"] = member_id;