-1

I have this problem that select returns the name of the column insted of the values in it. I have no idea what's causing that behavious.

Upper table is the result i get and lower table is the whole table that i would like to get a part of. Insted the 0's in wys are replaced with string wys and my script doesnt work because of this query

enter image description here

  • 2
    You are mixing backticks (`\``) with single quotes (`'`). Single quotes denote a literal string, backticks delimit an identifier. So, use `\`wys\``, not `'wys'`. – Wrikken Mar 06 '13 at 19:54
  • Dlaczego masz `index` na prawej stronie? – Kermit Mar 06 '13 at 20:07
  • Just gotta love the unnecessary backticks. My personal preference is to use a table alias... (e.g. `SELECT p.oceana, p.wys FROM POSTY p ` ). If you code that way, and you accidentally use the wrong quotes around a column name, MySQL will throw an error, rather than returning a literal string. – spencer7593 Mar 06 '13 at 20:16

2 Answers2

2

You're using regular quotes on wys, indicating a string literal;

'wys'

instead of - as you do on the other columns - backticks which indicate a table column name;

`ocena`

which makes MySQL use the string literal wys instead of the contents of the table column wys as a result for that result column in the query.

Joachim Isaksson
  • 176,943
  • 25
  • 281
  • 294
1

You should change your SELECT query like this:

SELECT `zdjecie`, `opis`, `tekst`, `ocena`, `wys`
  FROM POSTY
 LIMIT 0, 30
Mike Dinescu
  • 54,171
  • 16
  • 118
  • 151