RE: Select compare to current date

2004-06-28 Thread David Rodman
]= ]=What's the syntax for "year of current date"? YEAR(NOW()) (rtfm..:-) -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]

RE: Flowing Text Into Multiple Columns

2004-06-27 Thread David Rodman
]=Suppose I want to display an entire field, but not in ]=one long column. Instead, I want to flow it evenly ]=into several columns. ]= You're looking for the wrong type of screwdriver to drive this particular nail. MySQL is not a text processor. This could be done fairly simply with PHP. Depe

RE: Merging 2 Fields

2004-06-27 Thread David Rodman
]=> ]=> mysql> insert into nads values('Florida', ]=> 'http://www.florida.gov'); ]=> Query OK, 1 row affected (0.00 sec) ]= ]=I'm a little confused here. I'm slightly more familiar ]=with manipulating PHP than MySQL. It looks like your ]=suggestion is a permanent fix. It just occurred to me ]=that

RE: Merging 2 Fields

2004-06-26 Thread David Rodman
You mean something like this? mysql> create table nads( -> state varchar(50), -> url varchar(100)); Query OK, 0 rows affected (0.03 sec) mysql> insert into nads values('California', 'http://www.california.gov'); Query OK, 1 row affected (0.00 sec) mysql> insert into nads values('Florida'

Populating a from a database

2004-06-25 Thread David Rodman
Here's a way to do it with PHP: function field_select($table, $field) {$result = mysql_query("SELECT $field FROM $table") or die(mysql_error()); print "\n"; $limit = mysql_num_rows($result); for($i = 0; $i < $limit; ++$i) {list($value) = mysql_fetch_array($result);

Which constraint failed?

2004-06-25 Thread David Rodman
When an INSERT operation returns an error 1216 (parent row does not exist, FK constraint failed), and there are multiple FK constraints in the target table, how do you know which one failed?  Brute force method will work, of course (do a select on each foreign key in its referenced table).