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

[SQL/PHP] non-object problem (Phones off)

ExibeR

Lua/C++/PHP Programmer
Joined
Aug 15, 2007
Messages
986
Reaction score
8
Location
Tromso/Norway
2 scripts and 2 errors, just the way a computer should work.

I have 1 problem on each script, both scripts should work.
It's php btw, and I'm using Gesior and TFS 0.3.2

.php:
Fatal error: Call to a member function query() on a non-object in
Inside:
Code:
$wars = $SQL->query("

Same error in both scripts, so the problem is with the $SQL->query

Tables are added to database as well.
 
Last edited:
Please post he hole $wars line...

PHP:
$wars = $SQL->query("
	SELECT g.name AS gname, wg.name AS wgname, g.war_time AS gtime, g.kills AS kills, wg.kills AS ekills, g.show AS s, g.id AS gid
		FROM guilds AS g
	INNER JOIN guilds AS wg
		ON wg.id = g.in_war_with
	ORDER BY s DESC LIMIT 50;
");
 
maybe try adding this at the end:
PHP:
->fetch();
so:
PHP:
$wars = $SQL->query('
    SELECT g.name AS gname, wg.name AS wgname, g.war_time AS gtime, g.kills AS kills, wg.kills AS ekills, g.show AS s, g.id AS gid
        FROM guilds AS g
    INNER JOIN guilds AS wg
        ON wg.id = g.in_war_with
    ORDER BY s DESC LIMIT 50;
')->fetch();
 
maybe try adding this at the end:
PHP:
->fetch();
so:
PHP:
$wars = $SQL->query('
    SELECT g.name AS gname, wg.name AS wgname, g.war_time AS gtime, g.kills AS kills, wg.kills AS ekills, g.show AS s, g.id AS gid
        FROM guilds AS g
    INNER JOIN guilds AS wg
        ON wg.id = g.in_war_with
    ORDER BY s DESC LIMIT 50;
')->fetch();

Didn't work. It disabled some text, and just gave me new errors.
 
Back
Top