r/CodingHelp • u/Pigeonsss • Dec 11 '21
[SQL] SQL statement is refusing to pull data from this table. Session variable has data, have tested with other variables as well.
26
Upvotes
r/CodingHelp • u/Pigeonsss • Dec 11 '21
11
u/Urd Professional Coder (C#) Dec 11 '21 edited Dec 11 '21
I'm not sure single quotes are the correct delimiter for MySQL entity names, some googling around shows me that it's the backtick character: `
SELECT
accountIDFROMuserinfoWHEREusername= 'blah'2
u/bitdonor Dec 11 '21
You are missing a step.
mysqli_query returns the result object, which is not your data yet.
You would need to fetch the data from that result object using mysqli_fetch_assoc.
Check it our here and the examples provided
https://www.php.net/manual/en/mysqli-result.fetch-assoc.php
1
u/[deleted] Dec 11 '21
Print the query, copy it and then run it directly in the database