Welcome Guest, Not a member yet? Register   Sign In
spaces in MySQL columns

I'm having trouble inserting a record using the Active Record Class when the column name has a space in it. I've tried using brackets & '' but its not working as expected:


$data = array('Constituent Name' => $this->input->post('fullName', TRUE))

$this->db->insert('mis', $data);

This is actually the first time I've seen spaces in a table's filed name I don't know how to fix this...

Any help would be greatly appreciated. Thanks!

change the table name

its not the table name that is the problem, its the field in the table that has the space - and I can't change the name because the database is used by other applications which I have no control over....

[eluser]Randy Casburn[/eluser]
that's an unfortunate poor design that's been thrust upon you.

You must use backticks to surround your column name. You'll also have to finagle those through your PHP and JS string sanity and validation checks.

Best of luck.


Theme © iAndrew 2016 - Forum software by © MyBB