• 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!

Solved Weird error in php query

Nekiro

Legendary OT User
TFS Developer
Joined
Sep 7, 2015
Messages
2,684
Solutions
127
Reaction score
2,130
Hello, I cannot get this to work.

I'm using gesior.

What I'm trying?

270739a07914cafa97a4ee351aac7f9c.png


I'm trying to get "players_record" value into variable.

Code:
$record = $SQL->query("SELECT `value` FROM `server_config` WHERE `config` = players_record");
echo $record;

It's showing nothing... When I try:

Code:
$record = $SQL->query("SELECT `value` FROM `server_config` WHERE `config` = 'players_record'");
echo $record;

The site fail to load.
 
Code:
$record = $SQL->query("SELECT * FROM `server_config` WHERE `config` = 'players_record'")->fetch();
echo $record['value'];
 
Last edited:
Solution
Thank you works.

Could you explain why my didnt work and yours work?
 
Simply? Because you didn't fetch the data. I'm not sure where this come from, but I can only assume that your

PHP:
$SQL->query(...);

returns an SQL statement, not its result.
 
Back
Top