Re: html in a text field - good practice?

2004-08-19 Thread Parker Morse
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On Wednesday, Aug 18, 2004, at 13:59 US/Eastern, Steve Edberg wrote:
At 08:37 AM 8/18/04, leegold wrote:
Question I have wondered about: Is it a good practice to put html in a
text field, then (eg. via php) when the marked-up text renders in a
user's browser it's good looking html. If not, then I'd just sandwitch
field content in a p/p when it's rendered. Though, seems like it
would mess-up fulltext searching in a marked-up text field(?). Thanks.
Lee G.
I'd say that in general, it's best  to avoid storing markup with text, 
because (1) as you say, it could mess up fulltext search statistics, 
and (2) it makes it more complex to repurpose that data - eg; export 
it to PDF instead of HTML. It's best to keep rendering separate from 
content.
Amen. I've recently had good luck using the Markdown text format; for a 
description of the format, see 
http://daringfireball.net/projects/markdown/, and 
http://www.michelf.com/projects/php-markdown/ for PHP functions to 
render Markdown-formatted text into valid XHTML.

pjm
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.3 (Darwin)
iD8DBQFBJLApnRVGoRROKxIRAuzpAJ9DiG0xqD86boVViltNWNn0ORhHwACeMLoQ
I7vJrvYmO7g6Ugf3QCx8eT4=
=DIfU
-END PGP SIGNATURE-
--
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-28 Thread Parker Morse
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On Sunday, Jun 27, 2004, at 12:31 US/Eastern, David Blomstrom wrote:
Suppose I want to display an entire field, but not in
one long column. Instead, I want to flow it evenly
into several columns.
[snip]
I haven't yet learned of a way to do this with PHP, so
I wondered if there's some sort of trick you can use
with MySQL to flow text into multiple columns.
Not with MySQL. I've done it with PHP; I'll send that off-list.
pjm
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.3 (Darwin)
iD8DBQFA4BWcnRVGoRROKxIRAtzrAJ41Y1qUb40nvJBJQjcYD6/A2ryhtgCfS5Gr
szMV9uhfWN+KfLRBRByepic=
=c6Xw
-END PGP SIGNATURE-
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


Re: multiple values in one column

2003-11-13 Thread Parker Morse
On Thursday, Nov 13, 2003, at 02:55 US/Eastern, John Berman wrote:
Can  I have multiple values in one column and then index the column, I
have used different delimiters but the index only seems find the whole
contents of the column no matter what I separate the data with
It seems like you'd be better off with a modified database design. If 
you need multiple values in a column, you might be better off making an 
intersection table, and indexing that. So instead of having multiple 
values in column 1 of table A, you have multiple rows in table B, 
each with one value, referencing a single row in table A.

(I hope I've explained that clearly; if I've misunderstood, or someone 
has a better way of phrasing it, feel free to jump in.)

pjm


PGP.sig
Description: This is a digitally signed message part


Re: multiple values in one column

2003-11-13 Thread Parker Morse
On Thursday, Nov 13, 2003, at 12:03 US/Eastern, John Berman wrote:
I have a single table with 120 fields (its full of genealogical data)

All the records apart from marriages have an entry in the surname field
[snip]

Now marriages don't have an entry in surname but they do in 
groomsurname
and bridesurname, I figured if I copied the groom surname and
bridesurname to the main surname index that would do the trick ?

I did index groomsurname and bridesurname and then use a statement like

sql = SELECT COUNT(*) AS res, uniqueref FROM global  WHERE surname =
' globsurname  ' or groomsurname = ' globsurname  ' or
bridesurname = ' globsurname  'group by uniqueref
This gave me 2 problems, It really slowed down the search and if a
result was found I could not detrmine which field it was found in so
drilling down was a problem.
Wow. I think I had suspected this might be the problem.

I don't think there's any way of solving the two problems of really 
slowing down the search and not knowing which column matched without 
fundamentally changing your table structure.

It sounds like you've got the whole database in one table, which isn't 
really making use of the strengths of the DBMS. You'd do much better 
breaking this data out into multiple related tables. You'd still have 
to do multiple queries while looking for surnames, but the collected 
queries on the (much smaller) tables would be still be faster than the 
single query I've quoted above.

Without knowing what columns you have in your current table, I can't 
suggest how you'd break them down, but a good rule of thumb is that 
each table should contain only one kind of entity. So you probably 
shouldn't have marriages and individual persons in one table. (Far 
better to have a table of people, then a table of marriages which 
describes the relationships? Then you don't have bridesurname and 
groomsurname fields, just one surname field. You can also describe 
multiple marriages for a single person with a minimum of table space.)

This isn't the place (nor am I the right person, probably) to get into 
an extended discussion of database normalization, but if you search 
that phrase on the web you'll find quite a bit. Here's one place to 
start: http://databases.about.com/ (look under design). Many MySQL 
books will discuss normalization as well (it's in chapter 7 of the 
O'Reilly book I have here.)

pjm


PGP.sig
Description: This is a digitally signed message part


Re: Command not found

2003-09-05 Thread Parker Morse
On Friday, Sep 5, 2003, at 00:51 US/Eastern, [EMAIL PROTECTED] wrote:
I installed the MySQL 4.0 on my Linxus machine (red hat 7.3). The 
installation
shows no problem, and I can see that the 'mysqld' server is actually 
runing
through a command like ./bin/mysqladmin version. However, it just 
does not
allow me to switch to the mysql client program from my login shell. 
Whenever I
try to do so, it also says that bash: mysql: command not found.

I don't know how to deal with it. Could some MySQL experts please 
kindly help
me with this?
It's not a MySQL issue, it's a Linux issue. If your MySQL binaries are 
installed in a directory like /usr/local/mysql/bin/, they're not in one 
of the directories your shell (probably bash) looks in for commands. 
(To see which directories are being searched, type echo $PATH at the 
shell prompt.)

You'll need to edit the .bashrc file in your home directory to add the 
/usr/local/mysql/bin directory to the search path if you want to avoid 
typing the full path. Another alternative is to place links to the 
binaries in one of the directories already in the path, like /usr/bin/.

pjm

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


SOLVED Re: MySQL 4.0.14 stops responding to PHP 4.3.2

2003-09-05 Thread Parker Morse
On Thursday, Sep 4, 2003, at 12:47 US/Eastern, Parker Morse wrote:
No, it turns out this is not the key. With mysql_connect() I'm 
actually failing MORE often than with mysql_pconnect - so far it 
hasn't stayed up 15 minutes without error. (Fortunately, I have a cron 
job checking on it and restarting.)
However, this did put me on to the problem. I was tripping resource 
limits. When I was first setting up the server and getting the 
individual sites/users working in the mysql.user table, I saw the 
max_connections column set to 0 and thought that was a problem; I 
didn't realize that 0 meant no limit. So I set a limit. I was running 
up on the connection limits, which meant mysqld was refusing further 
connections until my server restart reset the counts to 0.

With mysql_connect I had more connections, and thus reached the limit 
faster.

Now I have reset the max_connections numbers to 0, and I haven't had a 
failure in twenty hours, so I think I can call this problem solved. 
Thanks for your help. In the course of sorting it out, I also learned a 
good deal about debugging mysql errors gracefully in PHP.

pjm

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


Re: Command not found

2003-09-05 Thread Parker Morse
On Friday, Sep 5, 2003, at 10:24 US/Eastern, Parker Morse wrote:
You'll need to edit the .bashrc file in your home directory to add the 
/usr/local/mysql/bin directory to the search path if you want to avoid 
typing the full path. Another alternative is to place links to the 
binaries in one of the directories already in the path, like  /usr/bin/.
I should correct myself - the file to look at is .bash_profile, not 
.bashrc, at least in RH 9.0. Or .tcsh_profile (or .tcshrc) if you use 
tcsh - I don't, so I'm not certain which file it would be in.

And, as Mike suggests, check to make sure the MySQL client is there at 
/usr/local/mysql/bin/mysql. It might be that simple.

pjm

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


Re: SOLVED Re: MySQL 4.0.14 stops responding to PHP 4.3.2

2003-09-05 Thread Parker Morse
On Friday, Sep 5, 2003, at 13:41 US/Eastern, Thierno Cissé wrote:
Finally you seem to say that you 've setting max_connections with a
limit.
Can you tell how many 100 or 200 ?
No. It turns out that setting max_connections to 0 is the same as 
setting no limit at all. This was my initial misunderstanding. The 
server is not currently in danger of overload, and I am sysadmin, DBA 
and primary web developer (small company), so I am free to work with no 
restrictions until I feel they're necessary.

Also you say :
Here's the configuration:
MySQL Ver 12.21 Distrib 4.0.14, for pc-linux (i686)
PHP 4.3.2
Red Hat 9.0
Have you enable QUERY CACHE feature with MySQL 4.0.14 ?
Not that I'm aware of. As I said in my first post, I'm familiar with 
MySQL from the web developer's standpoint, but this is my first 
experience running and tuning the server. I'm sure there's a lot of 
things I could be doing to configure it better, but it's not clear to 
me yet what they are. It's pretty much a default configuration now, 
with my_large.cnf with a few tweaks as the my.cnf file.

pjm

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


Re: Command not found

2003-09-05 Thread Parker Morse
On Friday, Sep 5, 2003, at 15:02 US/Eastern, hongbin liu wrote:
Thank you so much. I changed the profile according to what you guys 
told me,
and add /usr/local/mysql/bin to the profile. Guess what? It works 
great!

But I am not sure if I did the right thing: my computer uses bash, I 
could
not find either .bash_profile. There is only one file named profile 
under
the /etc/ directory. So I just put the /usr/local/mysql/bin into 
the
directory, and it works!
Adding that to the /etc/profile file will add it to the $PATH for all 
users, while adding it to a .profile or .bash_profile file will add it 
only for the particular user. Just so you have your permissions set 
correctly on the mysql binaries.

Glad it works...

pjm

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


Re: MySQL 4.0.14 stops responding to PHP 4.3.2

2003-09-04 Thread Parker Morse
On Thursday, Sep 4, 2003, at 01:27 US/Eastern, Antony Dovgal wrote:
Please, read 
http://www.php.net/manual/en/features.persistent-connections.php
I recommend you not to use *_pconnect. There are some big problems 
with persistent connections and these problems are 'by design'.
Use SQLrelay if you need real connection pooling.
In your case MySQL probably says 'too many connections' and you can 
catch this error message if you'll turn on error_log in php.ini.
That sounds like a plausible explanation - by restarting mysqld I'd be 
closing all the open connections, admittedly the hard way.

I've changed the mysql_pconnect() calls to mysql_connect(), and I'm 
reading up in the manual. I don't understand all of it yet, which 
should probably tell me to stick to mysql_connect! Meanwhile, I'll see 
if I have any more failures using mysql_connect.

Thanks,

pjm

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


Re: MySQL 4.0.14 stops responding to PHP 4.3.2

2003-09-04 Thread Parker Morse
On Thursday, Sep 4, 2003, at 10:03 US/Eastern, Parker Morse wrote:
On Thursday, Sep 4, 2003, at 01:27 US/Eastern, Antony Dovgal wrote:
Please, read 
http://www.php.net/manual/en/features.persistent-connections.php
I recommend you not to use *_pconnect. There are some big problems 
with persistent connections and these problems are 'by design'.
Use SQLrelay if you need real connection pooling.
In your case MySQL probably says 'too many connections' and you can 
catch this error message if you'll turn on error_log in php.ini.
That sounds like a plausible explanation - by restarting mysqld I'd be 
closing all the open connections, admittedly the hard way.

I've changed the mysql_pconnect() calls to mysql_connect(), and I'm 
reading up in the manual. I don't understand all of it yet, which 
should probably tell me to stick to mysql_connect! Meanwhile, I'll see 
if I have any more failures using mysql_connect.
No, it turns out this is not the key. With mysql_connect() I'm actually 
failing MORE often than with mysql_pconnect - so far it hasn't stayed 
up 15 minutes without error. (Fortunately, I have a cron job checking 
on it and restarting.)

I have error_log turned on in php.ini, but there's nothing at the 
specified path. Likewise, the mysql_error log is only showing the 
restarts.

pjm

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


MySQL 4.0.14 stops responding to PHP 4.3.2

2003-09-03 Thread Parker Morse
I've been using MySQL and PHP for a while in a shared hosting 
environment, but recently we shifted to a co-located server, so I am 
new to administering mysqld.

Periodically our PHP sites will fail to connect using mysql_pconnect(). 
We currently have three sites on the colo box (two more are waiting on 
shared hosting until I can solve this problem) and they all fail at 
once. mysqld is still running, though. If I shut down mysqld and 
restart, they are able to connect again. This makes me think the 
problem is with how I have MySQL configured. However, nothing useful is 
being logged anywhere in the /var/log heirarchy, so I can't figure out 
what's going wrong.

Here's the configuration:
MySQL Ver 12.21 Distrib 4.0.14, for pc-linux (i686)
PHP 4.3.2
Red Hat 9.0
I am starting MySQLd with mysqld_safe --user=mysql 
--bind-address=127.0.0.1. I don't have a my.conf file, so I seem to be 
running with defaults.

It's hard to get a picture of what's happening right before these 
lockups, but when I look after a lockup, load on the server doesn't 
appear to be an issue. (I haven't seen load average go over .50 except 
during the initial fcheck run, and most of the time it's 0.00.)

I have some mysql status snapshots from before and after a lockup. 
I've also been running mytop thanks to a suggestion on this list 
yesterday. If anyone thinks that information would be helpful, I can 
supply them.

Thanks for anything that might give me a toehold on this problem.

pjm

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]