Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 02-19-2006, 10:32 AM   #1 (permalink)
frostyservant
Master of the Universe
 
frostyservant's Avatar
 
Join Date: Feb 2006
Posts: 13
frostyservant is on a distinguished road
MySQL Defaults question

According to the MySQL documentation, "Text" and "Blob" columns can't have defaults. Anyone know a way around this? I would simply use isset() in my php script to determine if the user had input a value or not, and write in a default value for them if they hadn't, but there's a whole seperate litany of problems there that I'd rather not deal with if I don't have to.
frostyservant is offline   Reply With Quote
Old 02-20-2006, 12:28 AM   #2 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,532
sde is on a distinguished road
hmm .. can you set the default to NULL? then with mysql, you can check with:
Code:
select * from table where mytextfield is NULL
alternatively, if there was no default null set, and you wanted to query for the text fields that have no data, you could do this:
Code:
select * from table where mytextfield = ''
i don't know what exactly you are trying to accomplish, but give me more info if i didn't help. sometimes taking a step back and re-evaluating how you are trying to accomplish what you need to do helps.
sde is offline   Reply With Quote
Old 02-20-2006, 11:14 PM   #3 (permalink)
frostyservant
Master of the Universe
 
frostyservant's Avatar
 
Join Date: Feb 2006
Posts: 13
frostyservant is on a distinguished road
Sorry it took me so long to get back.

I've since figured out a PHP-based solution using addslashes(), but thank you for the help.
frostyservant is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
anyone know a lot? question concerns php also. Rotkiv HTML, XML, Javascript, AJAX 7 01-12-2006 01:09 PM
MySQL Replication / Failover idx Everything SQL ( MySQL, MSSQL, DB2, Postgre, Oracle, etc...) 2 02-23-2005 08:22 PM
and on to mysql .. sde Linux / BSD / OS X 2 01-18-2003 08:39 PM


All times are GMT -8. The time now is 12:59 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0 RC8 ©2007, Crawlability, Inc.





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting