Jump to content
The forums will be going offline for an extended maintenance period at 1400hrs GMT on 19th June 2025. The number of hours for this downtime is intentionally not advertised due to the nature of these upgrades. ×
  • 0

Query and String help


nasagnilac

Question


  • Group:  Members
  • Topic Count:  89
  • Topics Per Day:  0.02
  • Content Count:  232
  • Reputation:   15
  • Joined:  11/02/13
  • Last Seen:  

HI Im just having a problem with my script

-	script	Donate	-1,{

		setarray .@DonateItems[0],  5518, 5518, 25000;
		setarray .@DonateAmount[0],    1,    1,   100;
OnInit:
	bindatcmd "reward","Donate::OnDoDonate",100,100;
	end;

OnDoDonate:
	input $@email$;
	query_sql "SELECT `userid` FROM `login` WHERE `email` = '$@email$'",$@userid$;
			if (!$@email$) {dispbottom "The email is invalid."; end;}
	for( set .@i, 0; .@i < getarraysize(.@DonateItems); set .@i, .@i + 1 ){
	query_sql("INSERT INTO `rewardaccountnpc` ('account_id', 'reward_id' , 'reward_amount') VALUES ('$@userid$','.@DonateItems[.@i]','.@DonateAmount[.@i]')");
	}
}
	

When Im going to put the email [email protected]..

I got this kind of error... what is the problem?post-21795-0-87540000-1384076735_thumb.jpg

Edited by gmprestige
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:   616
  • Joined:  07/05/12
  • Last Seen:  

query_sql "SELECT `userid` FROM `login` WHERE `email` = '$@email$'",$@userid$;

should be

query_sql "SELECT `userid` FROM `login` WHERE `email` = '" + $@email$ + "'",$@userid$;

same thing in insert

 

 

if (!$@email$) ...

$@email$ is a string variable, "!" is unappropriate

it should be

if ($@email$ == "")

 

 

 

		setarray .@DonateItems[0],  5518, 5518, 25000;
		setarray .@DonateAmount[0],    1,    1,   100;
OnInit:

these arrays should be definited under OnDoDonate: label like that

OnDoDonate:
	setarray .@DonateItems[0],  5518, 5518, 25000;
	setarray .@DonateAmount[0],    1,    1,   100;
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...