Jump to content
  • 0

SQL Query not reading?


Pseudo

Question


  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  36
  • Reputation:   5
  • Joined:  05/02/15
  • Last Seen:  

I've been digging through the scripting release forums and I found the Family Gang thing made by Myzter. From my understanding, he hasn't been around for a while so I'll ask the general public for assistance.

 

Can someone tell me if this is wrong? Since everytime I input a "Family name" it always says, "This name is in use, blah blah"

l_Reinput:
		if (prompt("Write a name", "Give it to " + .@FNOther$) == 1) {
			input .@FN$;
			set .@SL, getstrlen(.@FN$);
			if (.@SL < 3 || .@SL > 50) {
				mes "[^0000ffFamily Gangs^000000]";
				mes "The family name must be between 4 and 50 characters long.";
				mes " ";
				mes " > ^0000ff" + .@FN$ + "^000000";
				next;
				goto l_Reinput;
			}

			// Verifica que el nombre no esté siendo utilizado por otra familia
			if (query_sql("select family_id from family where replace(family_name,' ','') = replace(trim('" + escape_sql(.@FN$) + "'),' ', '')", .@uno)) {
				mes "[^0000ffFamily Gangs^000000]";
				mes "This name is in use, please choose another.";
				mes " ";
				mes " > ^0000ff" + .@FN$ + "^000000";
				next;
				goto l_Reinput;
			}

			set .@FamilyName$, .@FN$;

			mes "[^0000ffFamily Gangs^000000]";
			mes "Very good, close this window to continue.";
			close2;
		} else {
			mes "[^0000ffFamily Gangs^000000]";
			mes "Okay, close this window to continue.";
			close2;
			message .@FNOther$, "¡" + .@FNTurn$ + " wants me to name the family!";
		}

The whole script is 1500 lines so I just posted the relevant section of it. 

 

Basically I am stuck at this part:

// Verifica que el nombre no esté siendo utilizado por otra familia
			if (query_sql("select family_id from family where replace(family_name,' ','') = replace(trim('" + escape_sql(.@FN$) + "'),' ', '')", .@uno)) {
				mes "[^0000ffFamily Gangs^000000]";
				mes "This name is in use, please choose another.";
				mes " ";
				mes " > ^0000ff" + .@FN$ + "^000000";
				next;
				goto l_Reinput;
			}

SQL tables have already been created as well. And there is no error in the map-server.

 

Thanks in advance!

 

 

Edit:

On a side note, anyone know why all my attacks "miss" when I'm attacking a mob while I'm disguised as a mob? (I don't think it's worth to make a new topic for a simple question.)

Edited by Pseudo
Link to comment
Share on other sites

1 answer to this question

Recommended Posts


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

Query now return -1 on failure/empty

 

Executes an SQL query. A 'select' query can fill array variables with up to 128 rows of values,
and will return the number of rows (i.e. array size) or -1 on failure/empty array.

Replace the condition by

if (query_sql("select family_id from family where replace(family_name,' ','') = replace(trim('" + escape_sql(.@FN$) + "'),' ', '')", .@uno) > 0) {
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...