Does anyone know how to add coding as a default value in a MySQL field?
I am trying to set a default value of an existing field, but the default value
I want to add is coding that includes * "" and !
I am using,
UPDATE `tbl_test` SET `newfield` = 'default value'
it works fine if the default value is plain text, but if I try to add the coding
as the default value, the last quotation mark gets removed resulting in an error.
Any help appreciated.
Just to add.
The site is in .ASP (php enabled) and I am trying to do it via phpmyadmin
and has to remain exactly the same, spread over the 11 lines
when I add it as the default value between the ' ' the 2nd ' gets deleted
when running the query
Try enclosing it in " quotation marks, and changing the ones in the code to ' quote ation marks. i.e. change the javascript to single quotes etc. then enclose the whole lot in "
just tested this and it worked okay for me (via phpmyadmin). What type is the field you're trying to update ie text/varchar? If varchar, is it possible that the code string is longer than the maximum number of characters?
Also, is phpmyadmin throwing an error, or is it just that part of the code isn't being stored?
__________________
Yorkshire Business Directory Yorkshiresource
If you mean ''Javascript'' instead of "Javascript" I'm not sure that will work as code, should be 'javascript'
When it is added to the database one of the single quotation marks gets
dropped, so the code generated on the page changes from
''javascipt'' to 'javascript'