PDA

View Full Version : Can anyone Insert or Replace my SQL trouble?



danielle v2.1b
11-22-2004, 03:10 AM
Hiya,

I made a database driven site a while ago and made a particular field optional. As the site has progressed, I've realised this was a silly thing to of have done because searches against this field are only listing the partial result from those that filled it.

What I'd like to do is run an SQL query on my database to fill in all the old records that are blank with a default value only I'm not sure how to best do this. Oh how WYSIWYG software makes us soft in the head!

My table is called "pictures" and it has a column called "type". Whilst my SQL knowledge is good enough to select all the blank fields, I don't know how to fill them all without going through them one at a time. Should I be using Insert or Replace or am I way off with both those? Any help or pointers would not only be most gratefully appreciated, they'd stop a young blonde looking real silly after she's pulled all her hair out!!!

Many thanks,
Danielle

mushroom
11-22-2004, 10:20 PM
Update is what you want to use.

mysql_query("UPDATE table SET your_field='default_value' where your_field=''");

mushroom
11-22-2004, 10:21 PM
Update is what you want to use.

mysql_query("UPDATE table SET your_field='default_value' where your_field=''");

mushroom
11-22-2004, 10:23 PM
Update is what you want to use.

("UPDATE table SET your_field='default_value' where your_field=''");

mushroom
11-22-2004, 10:23 PM
Update is what you want to use.

("UPDATE table SET your_field='default_value' where your_field=''");

mushroom
11-22-2004, 10:27 PM
Update is what you want to use.

mysql_query("UPDATE table SET your_field='default_value' where your_field=''");

mushroom
11-22-2004, 10:28 PM
Update is what you want to use.

danielle v2.1b
11-22-2004, 11:32 PM
Thanks you sooooooo much, that took but 0.0048seconds to update 237 entries, how cool is that?!! Mushroom, you really are one fun guy! Much indebted!

Mwah,
Dani x

mushroom
11-23-2004, 01:23 PM
Had troble when I posted my anwser to your post, keep seeing error codes and keept trying

Warning: fsockopen(): unable to connect to localhost:25 in /data2/htdocs/phpBB2/includes/smtp.php on line 109 and

Could not connect to smtp host : 111 : Connection refused

DEBUG MODE

Line : 111
File : /data2/htdocs/phpBB2/includes/smtp.php