• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

AAC Znote AAC - SELECT `id`

roriscrave

Advanced OT User
Joined
Dec 7, 2011
Messages
1,188
Solutions
34
Reaction score
200
Hi, how can i select a player ID according to the name found ??
this func get the name: Znote/ZnoteAAC (https://github.com/Znote/ZnoteAAC/blob/master/myaccount.php#L8)

i tried to add it down, to check player ID:
PHP:
$undelete_q3 = mysql_select_single("SELECT `id` FROM `players` WHERE `name`=' . $undelete_q1 . '");
but i get this error, why?
Code:
Notice: Array to string conversion in C:\xampp\htdocs\myaccount.php on line 9
 
$undelete_q1 is not a string, it's defined as an array
and what is the solution? i tried sometihng like it:
PHP:
$undelete_q3 = mysql_select_single("SELECT `id` FROM `players` WHERE `name`=' . $undelete_q1['character_name'] . '");
but dont works too
Code:
Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting '-' or identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in C:\xampp\htdocs\myaccount.php on line 9
 
The issue is that you are using double-qoutes, in php it will parse the inline-variables enclosed anyways.
[PS] Don't use strings directly without escaping them.

PHP:
$character_name = mysql_znote_escape_string($undelete_q1['character_name']);
$undelete_q3 = mysql_select_single("SELECT `id` FROM `players` WHERE `name`='$character_name'");
 
Last edited:
The issue is that you are using double-qoutes, in php it will parse the inline-variables enclosed anyways.
[PS] Don't use strings directly without escaping them.

PHP:
$character_name = mysql_znote_escape_string($undelete_q1['character_name']);
$undelete_q3 = mysql_select_single("SELECT `id` FROM `players` WHERE `name`=$character_name");
thx to try help, but dont worked.
Code:
string(45) "SELECT `id` FROM `players` WHERE `name`=Floww"
(query - SQL error)
Type: select_single (select single row from database)

Unknown column 'Floww' in 'where clause'

Floww is a nick of a character, do u know how can i solve it? And have this players in table players
1577586071793.png
 
Post edited, check it again.
this part worked, but have another error here, can u help?

Lua:
$character_nome = mysql_znote_escape_string($undelete_q1['character_name']);
$undelete_q3 = mysql_select_single("SELECT `id` FROM `players` WHERE `name`= '$character_nome'");
mysql_update("UPDATE `players` SET `deletion`= '0' WHERE `id`= '$undelete_q3'");

i added this new line and get a error:

Code:
Notice: Array to string conversion in C:\xampp\htdocs\myaccount.php on line 12
Pending delete of Flipe has been successfully cancelled.

the line with error:
Lua:
mysql_update("UPDATE `players` SET `deletion`= '0' WHERE `id`= '$undelete_q3'");
 
Back
Top