Mysql error:| |
[eluser]Young Caveman[/eluser]
Hi! I put this in a module: Code: $query = $this->db->query('SELECT * FROM e-mail WHERE e-mail = '.$mail); but it outputs: Code: Error Number: 1064 I can't understand why cause i always did like that when querying the db. :| Thanks in advance guys. Don ~ Alberto
[eluser]_asdf[/eluser]
It sounds like CI is being ('over')-zealous in its escaping fields/columns, because of your bad practice. Naming tables and columns the same = bad idea. Naming tables or columns after reserved words = bad idea. Both of these are possible, but seriously better off avoided.
[eluser]Young Caveman[/eluser]
[quote author="_asdf" date="1209159400"]It sounds like CI is being ('over')-zealous in its escaping fields/columns, because of your bad practice. Naming tables and columns the same = bad idea. Naming tables or columns after reserved words = bad idea. Both of these are possible, but seriously better off avoided.[/quote] Can't understand what "reserved words" are :|
[eluser]TheFuzzy0ne[/eluser]
[quote author="Sensuous." date="1209156958"]Hi! I put this in a module: Code: $query = $this->db->query('SELECT * FROM e-mail WHERE e-mail = '.$mail); but it outputs: Code: Error Number: 1064 I can't understand why cause i always did like that when querying the db. :| Thanks in advance guys. Don ~ Alberto[/quote] Error 1064 is simply a parse error. Naming tables/columns with underscores instead of hyphens is much better practice. You may find that encapsulating the table name in quotes may help. I would advise that you just change the table/column name(s) to "email" or "e_mail".
[eluser]Young Caveman[/eluser]
[quote author="TheFuzzy0ne" date="1209164822"] Error 1064 is simply a parse error. Naming tables/columns with underscores instead of hyphens is much better practice. You may find that encapsulating the table name in quotes may help. I would advise that you just change the table/column name(s) to "email" or "e_mail".[/quote] Thanks it works. :-) |
Welcome Guest, Not a member yet? Register Sign In |