Retrieving a Name From MySQL Based on ID

Yes, that’s exactly what I was doing with the ListBox. Having no expertise in SQL, it was a quick alternative since the SELECT WHERE statement wasn’t working. Now that it’s working, I can just get rid of both. Thanks!

1 Like

But Members doesn’t have a column called Nic, so how is it you are able to query it? Your original query should have worked, and your new one should be giving the Nil exception.

Anyone know whether MySQL is case-sensitive for table names etc in queries?

Correct, the table I was using several weeks ago (Members) did not have a column called Nic. But the modified version of it I’m now using does. :slight_smile:

Be careful using common words for the rows/fields, see that ‘First’ and ‘Last’ are not black.

See: https://dev.mysql.com/doc/refman/8.0/en/keywords.html

In MySQL you can force symbols being treated as identifiers using `backticks`

SELECT `TABLE` FROM TABLE;

The ANSI standard are double quotes. SELECT "TABLE" FROM TABLE;

That differs from strings, that are set using single quotes.

Double quotes must be avoided on MySQL, it defaults to strings, but MySQL has an option that if set it start to interpret as identifiers to keep compatibility with other servers. So in one server it may work, but in another one it causes headaches. So just avoid it on MySQL.

Prefer single quotes for strings as SELECT 'TABLE';

image

Wrong:
image

Acceptable if you have a table with a field TABLE on it:
image

Thanks you so much for the useful info, guys! It’'s much appreciated!

1 Like

That usually means the original query string contained a bad character that you couldn’t see. Often caused by copy/paste into your code. It has happened to me in the past.