active record with column name spaces |
[eluser]skunkbad[/eluser]
[quote author="xeroblast" date="1333429311"]to start, i created mysql column names with spaces because i needed it for headers in the HTML Table library ( http://ellislab.com/codeigniter/user-gui...table.html ). i have a solution in getting the data by disabling the backticks in select query Code: $columns = '`column 1`,`column 2`'; now, for the insert query, how do i disable the backticks. the 3rd parameter for Quote:$db->set()is for the value, not the key. hoping there was a 4th parameter that disable the backticks for keys. thanks. hope anyone could help.[/quote] Why not just use some php and have normal column names? It couldn't be easier to name your column names with underscores and remove them for display. You could even use ucfirst() if you want to capitalize the name. You're just shooting yourself in the foot when you go with bizarre column names. I know because one of the projects I am working on now is spec work, and the column names have made things a lot harder than they had to be. Code: $name_without_underscores = str_replace('_','','some_name_with_underscores_in_it'); |
Messages In This Thread |
active record with column name spaces - by El Forum - 04-02-2012, 10:01 PM
active record with column name spaces - by El Forum - 04-02-2012, 11:22 PM
active record with column name spaces - by El Forum - 04-02-2012, 11:56 PM
active record with column name spaces - by El Forum - 04-03-2012, 02:57 AM
active record with column name spaces - by El Forum - 04-03-2012, 03:12 AM
active record with column name spaces - by El Forum - 04-03-2012, 03:22 AM
|