close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Need to change some entries in column to NULL

Thread began 8/07/2017 6:19 pm by EmmaMorris | Last modified 8/08/2017 9:21 pm by Ray Borduin | 2563 views | 10 replies |

EmmaMorris

Need to change some entries in column to NULL

I have just started updating a website that I setup with an earlier version of WA extensions. Changing it over to mysqli at the same time.

I found a few things in the actual db that I need to change. I have a phone2 field that for some has 3 different values in it. NULL which is NOW the default (it was   for some reason. Did it 7 or 8 years ago so dont know why. The other values are   and then a bunch with actual phone numbers.

I have searched online and have succeeded on messing up the table ( dropped and restored already) for a way to change the   to NULL. I dont want to change the ones with actual phone numbers. I managed to set it ALL to NULL which is when I restored a backup.

Here is one I tried that obviously didnt work..
UPDATE alumni SET phone2 = NULL WHERE phone2 = ' ';

Hoping I can get a little guidance. I am beginning to think it isn't possible. can this be done? There are 96 rows to do. I will do manually if I have to but would prefer not to..
Thanks.

Sign in to reply to this post

Ray BorduinWebAssist

Your sample update statement should work. What was the result when you tried?

Sign in to reply to this post
Did this help? Tips are appreciated...

EmmaMorris

Ok.. My bad.. Got that to work. I was running the 'simulate query' when it gave the error.. Actually running it succeeded.

Got rid of the   .. Found another character I need to get rid of. It is the  character. Doing some searching it seems to have something to do with the collation. It is set as latin1_swedish_ci . Should I change that to a different collation and will that mess up the db by doing so.

If I do the same UPDATE with that character (Â) it does not find it so I cant get rid of it.

Sign in to reply to this post

Ray BorduinWebAssist

If you change it to utf8 it should help. Then copy the character from one of the fields and paste it into the update query and it should find it. That is a garbage character that could actually be several characters, so you may have to copy it more than once.

Sign in to reply to this post
Did this help? Tips are appreciated...

EmmaMorris

Sounds. great.. Thanks Ray!!

Got it switched to UTF-8. Copied and pasted that character into the sql and it does not find anything. Found there are over 200 of them by just looking...

Sign in to reply to this post

Ray BorduinWebAssist

What SQL statement are you using to find and replace the character?

Sign in to reply to this post
Did this help? Tips are appreciated...

EmmaMorris

in phpmyadmin going into one of the records that has it and copy it from there.
UPDATE * FROM `alumni` SET `phone2` = NULL WHERE `phone2` = 'Â '; did it with and without the space after. Thats what the paste did, with the space.
Tried it with Select also just to view it.. nata..
Its not that big of a deal. I can manually delete them although learning what is going on would be nice.
Thanks.

Sign in to reply to this post

Ray BorduinWebAssist

Is that the full value of the field with the space? I'd have to play around with it, but there is probably another hidden character before or after that is causing the match to not work.

Have you tried:
SELECT * FROM `alumni` SET `phone2` = NULL WHERE `phone2` LIKE '%Â%'

Sign in to reply to this post
Did this help? Tips are appreciated...

EmmaMorris

Very strange result.
I am able to do a SELECT * FROM 'alumni' WHERE 'phone2' LIKE '%Â %'; and it finds 414 entries.
Try the update statement you just gave me and it fails. No specifics. Just that line.

Sign in to reply to this post

Ray BorduinWebAssist

Should just be:
UPDATE `alumni` SET `phone2` = NULL WHERE `phone2` LIKE '%Â%'

Sign in to reply to this post
Did this help? Tips are appreciated...
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...