![]() |
Mysqli - using select case but other data is not bound
I'm using Mysqli OO to search the database for 2 specific values using the MySQL statement CASE. If both values are found then it will return the value 'true', if only one is found the value is 'false', if neither are found then the result is neither. Anyway I've got this working but my problem is I need it to also display the values that are related in the column.
PHP Code:
Code:
User: ryan Email: local@localhost Code: 12 Answer: trueCode:
User: userName Email: email Code: code Answer: trueBTW I have posted it in the PHP area as well just for the simple reason I'm not entirely sure which part it is, so sorry if I'm not allowed to do this :confused: |
Has nothing to do with bind or mysqli.
When you use apostrophes around anything in SQL (any SQL, not just MySQL), you are creating a STRING. A literal string. Exactly what is in the apostrophes. In other words, if you use Code:
SELECT 'username';You surely need to and meant to use backticks (the ` character that shares a keyboard key with the ~ tilde). Code:
$query = "SELECT `userName`,`email`,`code`, ...Code:
$query = "SELECT userName,email,code, ... |
You have another problem in the SQL, by the by.
Code:
CASE You have no WHEN to handle that, so answer will be NULL. Not sure your CASE really makes sense, as given. |
| All times are GMT +1. The time now is 02:17 PM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.