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

PHP + MySQL = select + var

LucasFerraz

Systems Analyst
Joined
Jun 10, 2010
Messages
2,858
Reaction score
96
Location
Brazil
Hello,
how can I show this var?
$gamecode = XXXXX-XXXXX--XXXXX-XXXXX;
$count = $SQL->query("select count(*) from gamecodes WHERE gamecode='.$gamecode.' AND alreadyused='N';");

echo $count;

Error:
Catchable fatal error: Object of class PDOStatement could not be converted to string in Gesiorpath\htdocs\pages\accountmanagement.php on line 677
 
Can you show that line 677 from accountmanagement.php ?

Is you var $gamecode inside quotes? $gamecode = "XXXXX-XXXXX--XXXXX-XXXXX";

You may also need to fetch the results:
PHP:
$query = "SELECT count(*) FROM `gamecodes` WHERE gamecode='".$gamecode."' AND alreadyused='N'";
$result = $SQL->prepare($query);
$result->execute();
$number_of_rows = $result->fetchColumn();

echo $number_of_rows;
 
Last edited:
Back
Top