Re: getting totals with data

2002-06-18 Thread Erik Price


On Monday, June 17, 2002, at 05:44  PM, Galen Wright-Watson wrote:

 Another option is to SELECT INTO a temporary table (or CREATE 
 TEMPORARY ...
 SELECT), then query the temporary table for the total_hits.

Would the overhead of generating a temporary table for this query be 
worthwhile?  I'm wondering, since the query will be executed by a PHP 
script (which of course has a number of other queries that execute along 
with it).  Or would just having a query that strictly returns a COUNT of 
results, then a separate query returning the actual results (but 
constrained by LIMIT) be more resource-efficient... I wonder.

 The reference to table1.total_hits is correct only if table1 has a 
 column
 called total_hits.  You don't need to (and can't) prefix a column alias 
 by a
 table name (I think; a few small experiments seemed to confirm this).

This is useful knowledge, I somehow thought that aliased result columns 
could be treated like regular columns.

 I just thought of another possibility if all you want is the number of
 matching rows.  If you're using an SQL client, it should report the 
 number
 of rows returned.  If you're using an API to talk to the server, there 
 should
 be a function to get the number of rows in a query result (e.g.
 mysql_num_rows() in the C and PHP APIs).

This would be perfect except that it seems that my LIMIT clause (which 
helps keep the number of results that are handed to the PHP script and 
turned into HTML low) would yield the LIMITed number of rows, whereas 
I'm trying to determine how many rows would be returned if I had not 
used LIMIT (the total hits part of displaying X through X of X total 
hits).


Thanks for the pointers, Galen.




Erik

PS: to any who respond to this thread, please CC me as I have 
temporarily unsubbed the list.






Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




is this query possible?

2002-06-14 Thread Erik Price

I have a query that I have in mind, but am not sure of how I can 
actually write it.  It might not even be possible.  I was hoping someone 
could tell me if I will have to use two queries instead, or if this will 
actually work:

(In simplified form:)

  ++
+---+| main   |
| sub1  |+++---+
+---+| id || sub2  |
| id|---| sub1fk |+---+
| other || sub2fk |---| id|
+---+++| other |
+---+

As you can see from the simple diagram, I have a main table with its own 
primary key (id) but with two foreign key columns.  The first one 
(sub1fk) points to the primary key of the table sub1.  The second one 
(sub2fk) points to the primary ky of the table sub2.

The query I'm trying to build would look something like this:

SELECT  main.id,
 IF(main.sub1fk,sub1.other,NULL) AS sub1other,
 IF(main.sub2fk,sub2.other,NULL) AS sub2other
FROMmain, sub1, sub2
WHERE   main.id = some_criteria_or_other
AND sub1.id = main.sub1fk
AND sub2.id = main.sub2fk;


The above SQL, of course, won't work -- because there are no situations 
where all of the WHERE clauses are true.  Rather, I'm trying to get a 
result set that would look like this (again, this is in theory):

++---+---+
| id | sub1other | sub2other |
++---+---+
|  1 | 2 |  NULL |
|  2 |  NULL | 5 |
|  3 |  NULL |17 |
|  4 | 8 |  NULL |
| .. |...etc |...etc |
++---+---+

Later, in my application, I can test each column for NULL and I will 
know that the other column is the one to use (for instance, if the value 
of the sub1other column is NULL in one record, then I'll use the value 
of sub2other to do what I want to do, and vice versa).

But this just doesn't seem possible.  I can always do it with two 
separate queries if need be, but it would be elegant to do it with one.  
Any advice?

Thanks very much,

Erik





Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: MySQL not starting ?

2002-06-14 Thread Erik Price


On Friday, June 14, 2002, at 03:48  PM, Laura Findley wrote:


 Normally, I issue the command:

 [root@localhost root]# safe_mysqld -user=root 
 [1] 1781
 [root@localhost root]# Starting mysqld daemon with databases from
 /var/lib/mysql
 020614 02:09:36  mysqld ended

Are you really only using one hyphen before user?  Try using two:

[root]# safe_mysqld --user=root 






Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: is this query possible?

2002-06-14 Thread Erik Price

Hey, that's exactly what I needed!  And I can still use WHERE clauses to 
further limit my results.  That's great, thank you!

I have one question though.  In this LEFT JOIN syntax, you used the 
following format:

LEFT JOIN secondary_table ON primary_table.col = secondary_table.col

Is this optimized?  In the case of WHERE clauses, for instance, I always 
put the main (most-limiting) criteria on the right side of the equals 
sign and the uncertain (least-limiting) criteria on the left side of the 
equals sign.

Since I've never used LEFT JOIN before, I am unsure of the best way to 
do it.


Erik



On Friday, June 14, 2002, at 04:05  PM, Luc Foisy wrote:

 How bout

 SELECT main.id, sub1.other, sub2.other FROM main LEFT JOIN sub1 ON 
 main.sub1fk = sub1.id LEFT JOIN sub2 ON main.sub2fk = sub2.id

 Luc
 mysql,sql

 -Original Message-
 From: Erik Price [mailto:[EMAIL PROTECTED]]
 Sent: Friday, June 14, 2002 3:54 PM
 To: [EMAIL PROTECTED]
 Subject: is this query possible?


 I have a query that I have in mind, but am not sure of how I can
 actually write it.  It might not even be possible.  I was
 hoping someone
 could tell me if I will have to use two queries instead, or
 if this will
 actually work:

 (In simplified form:)

   ++
 +---+| main   |
 | sub1  |+++---+
 +---+| id || sub2  |
 | id|---| sub1fk |+---+
 | other || sub2fk |---| id|
 +---+++| other |
 +---+

 As you can see from the simple diagram, I have a main table
 with its own
 primary key (id) but with two foreign key columns.  The first one
 (sub1fk) points to the primary key of the table sub1.  The
 second one
 (sub2fk) points to the primary ky of the table sub2.

 The query I'm trying to build would look something like this:

 SELECT  main.id,
  IF(main.sub1fk,sub1.other,NULL) AS sub1other,
  IF(main.sub2fk,sub2.other,NULL) AS sub2other
 FROMmain, sub1, sub2
 WHERE   main.id = some_criteria_or_other
 AND sub1.id = main.sub1fk
 AND sub2.id = main.sub2fk;


 The above SQL, of course, won't work -- because there are no
 situations
 where all of the WHERE clauses are true.  Rather, I'm trying to get a
 result set that would look like this (again, this is in theory):

 ++---+---+
 | id | sub1other | sub2other |
 ++---+---+
 |  1 | 2 |  NULL |
 |  2 |  NULL | 5 |
 |  3 |  NULL |17 |
 |  4 | 8 |  NULL |
 | .. |...etc |...etc |
 ++---+---+

 Later, in my application, I can test each column for NULL and I will
 know that the other column is the one to use (for instance,
 if the value
 of the sub1other column is NULL in one record, then I'll
 use the value
 of sub2other to do what I want to do, and vice versa).

 But this just doesn't seem possible.  I can always do it with two
 separate queries if need be, but it would be elegant to do it
 with one.
 Any advice?

 Thanks very much,

 Erik



 

 Erik Price
 Web Developer Temp
 Media Lab, H.H. Brown
 [EMAIL PROTECTED]









Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: Reconstructing SQL create table statements

2002-06-14 Thread Erik Price


On Friday, June 14, 2002, at 04:06  PM, Hihn Jason wrote:

 I have a large number of tables that have been created through the 
 years,
 and I wish to obtain the SQL statements used to create them. I can go
 through and do it all by hand, but that would take forever. Is there a 
 way
 to run a script against the database that will generate them for me? If 
 it
 misses the occasional additional index, then that is fine.

If you have the mysql client programs and are using a Unix machine 
(maybe even Win but I'm not sure) you can use the mysqldump program.  It 
is usually located in the bin directory of your MySQL distribution.  
Mine is /usr/local/mysql/bin/mysqldump.

Read up on it, it can dump all data from your database and does so with 
the CREATE TABLE statements attached so that the whole thing can 
literally be rebuilt from scratch.  Just chop off the contents if you 
only want the CREATE TABLE statements.


Erik






Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




mulitple uses of a foreign key

2002-05-29 Thread Erik Price

I was hoping for some help with this -- I'm not sure if I can use just 
one SQL statement to pull this data out, I think I need to use two 
separate statements.  Can someone clarify for me?

My tables:

+-+  +---+
| people  |  | projects  |
+-+  +---+
| people_id   |-| project_id|
| people_name |  | project_name  |
+-+  | canceler_id   |
  | canceled_date |
  | finisher_id   |
  | finished_date |
  +---+

In the projects table, a project will have a project_id, a 
project_name, and either a canceler_id and canceled_date or a 
finisher_id and finished_date.  I would like to use a query to get the 
project name and the people name from the database WHERE 
projects.project_id = 8 AND projects.canceler_id = people.people_id, or 
projects.finisher_id = people.people_id, depending on whether the 
project was finished or canceled.  But I also need to be able to 
determine from the query whether the project was finished or canceled.




Thanks!

Erik




Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: MySQL on OS X

2002-04-25 Thread Erik Price


On Thursday, April 25, 2002, at 03:23  AM, Markus Ungersboeck wrote:


 I've tried to install the current release of MySQL on my Macintosh 
 under OS
 X (10.1.4)
 and I've got the following error message:

 dyld: ./bin/mysqld can't open library: /usr/lib/libpthread.A.dylib  (No
 such file or directory, errno = 2)
 Installation of grant tables failed!

 Where can I get this library for my system?

Are you trying to do a source install, or the binary provided on the 
MySQL web site?

On my system, /usr/lib/libpthread.dylib is a link to 
/usr/lib/libSystem.dylib, which is a link to /usr/lib/libSystem.B.dylib

I'm running 10.1.3, with the Dec2001 Developer Tools installed.  Perhaps 
it was provided by those, do you have them installed?


Erik





Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: AW: MySQL on OS X

2002-04-25 Thread Erik Price

Greetings from Massachusetts (USA),

On Thursday, April 25, 2002, at 11:04  AM, Markus Ungersboeck wrote:

 I've tried both kinds, the binary package and the source installation. 
 I've
 also the Developer Tools 10.3.1 (but a few days ago I've upgraded my OS 
 to
 10.1.4) on my computer and I have the libpthread.dylib library in the
 /usr/lib/ directory, but not libpthread.A.dylib.

 As I'm a complete newbe concerning the commandline installation of 
 software
 I've tried it first with the binary without success. Maybe I should
 reinstall the Developer Tools.

Just to make sure we're on the same level, I'm going to tell you some 
information you probably already know:
- Developer tools provide you with a compiler that you need to build C 
and C++ (and other languages) source code into binary code
- There are two different ways to put MySQL on your Mac OS X system:  
Install the precompiled binary, or build your own binary from source code
- The MySQL binary on the web site, that is built for Mac OS X, does 
NOT need to be compiled, so you do NOT need the developer tools to use it

 Erik - what version of SQL (and installation method) have you used?

I've successfully installed MySQL 3.23.45 from source code on 10.1.2 
using the September 2001 Developer Tools, but that version had a bug 
when used on OS X that prevented it from shutting down properly.  So 
when 3.23.46 came out, I built that to replace the other one.

Shortly afterward, MySQL started providing pre-compiled binary packages 
on their site for Mac OS X users (as they had been doing for Linux and 
other Unix users).  With this, nobody even needs to build their own 
unless there is something specific they have in mind.

Just to clarify -- MySQL is the name of a database management system, 
and includes both a server and client programs.  You never directly use 
the server, rather, you use client programs like mysql (note the case 
difference) to access the server in a human-friendly way.  When you 
install (either the source or the binary) MySQL, you get both.

After learning how to use MySQL on my Mac OS X machine, I built it a 
third time on a Linux box (3.23.46), and removed the Mac OS X 
installation for disk space.  But rather than ssh/telnet to the Linux 
box to access the mysql client program, you can use the mysql client 
program remotely.  So I downloaded the binary package of MySQL for Mac 
OS X, and although I don't use the server that is included in it, I use 
the client all the time.  And the beauty of this is that I didn't have 
to go through the hassle of compiling.

The moral of the story?  You can build from source, or you can just use 
a binary.  I've tried both, and unless you have a special need for a 
customized source install, there is really no difference.  The link I 
sent you that I got from the other guy (for www.entropy.ch) is one place 
that you can get a pre-compiled MySQL binary package, although I haven't 
used it many people say it is a good package.  I can vouch for the 
binary package provided on the MySQL web site, which is built 
specifically for Mac OS X.  (I've only used it on 10.1.3, but there is 
hardly any difference between 10.1.3 and 10.1.4 for these purposes.)

I recommend you just use a binary.

Erik

PS: if you have any other questions please don't hesitate to ask.






Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: how to get support help?

2002-04-25 Thread Erik Price
 Message


 -
 Before posting, please check:
http://www.mysql.com/manual.php   (the manual)
http://lists.mysql.com/   (the list archive)

 To request this thread, e-mail [EMAIL PROTECTED]
 To unsubscribe, e-mail mysql-unsubscribe-
 [EMAIL PROTECTED]
 Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php









Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: how to get support help?

2002-04-25 Thread Erik Price


On Thursday, April 25, 2002, at 01:29  PM, Clay Loveless wrote:

 I'm just trying to figure out why my carefully and thoughtfully 
 researched
 help request has gone unanswered (or even commented on) for nearly a 
 week.
 Based on the other responses I've seen to what are essentially RTFM
 questions/answers, I'm stumped on why a legitimate, undocumented problem
 doesn't seem to be a concern to anyone but me.

Did you submit a bug report?

http://www.mysql.com/doc/B/u/Bug_reports.html


Erik



PS: way off the subject,

 a platform that's getting as much publicity
 as Mac OS X Server

Mac OS X gets a lot of publicity for making a Unix system that can be 
'administrated' by anyone, regardless of their technical abilities.  But 
for a serving environment, it doesn't hold a candle to Linux, unless 
you're using it for an all-Mac OS X network, in which case NetInfo is 
admittedly powerful.







Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: how to get support help?

2002-04-25 Thread Erik Price


On Thursday, April 25, 2002, at 01:50  PM, Clay Loveless wrote:

 I'll make a note that the MySQL mailing list welcomes messages from 
 people
 shrieking HELP!!! even though they clearly haven't bothered to read 
 the
 manual, but offers little to those who've actually tried to resolve a
 problem on their own BEFORE wasting everyone else's time and bandwidth.

I reply to messages where I believe I can help the person, even if that 
means a RTFM reminder.  I don't reply to messages where I have no idea 
how to help the person, though you're correct -- this does not reassure 
them that their problem was heard.



Erik





Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

2002-04-25 Thread Erik Price


On Thursday, April 25, 2002, at 04:17  PM, Andrew Rich wrote:


 Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)


 Any ideas ?

You might need to specify the path to your socket file when you start 
MySQL... did you specify a specific socket location at compile time?  If 
so, use that.

It would look something like:

/usr/local/mysql/bin/safe_mysqld --socket=/path/to/socket


Good luck




Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: Order by

2002-04-25 Thread Erik Price


On Thursday, April 25, 2002, at 04:40  PM, Steve Buehler wrote:

 Is there a way to use ORDER BY, or something else, that will order 
 the following in numerical order instead of alphabetical order?  The 
 column that the data is in is:
 short_description varchar(20) default NULL.

 21UG3
 10UB5
 100UB6
 1UG1

What you want to do is somewhat difficult because of the 
inconsistency -- in the fourth example, the letter comes in the second 
position and in the others the letter is in the third or fourth 
position.  So you can't reliably use the MySQL SUBSTRING() function to 
get just the first two digits, or what have you.  But you could pad the 
left with zeroes using LPAD(), use SUBSTRING() to get the number-only 
part, and then add zero to convert it to a number.

SELECT *
FROM test
ORDER BY SUBSTRING(LPAD(short_description, 7, '0'), 1, 4) + 0

The only thing is that if your data is of greater length than the ones 
you've provided, you'll have to LPAD it to a greater number (change the 
7 to something larger than the longest string) and whatever number you 
increment this by, also increment the LEN parameter to the SUBSTRING() 
function.  So you could also write the above as

SELECT *
FROM test
ORDER BY SUBSTRING(LPAD(short_description, 11, '0'), 1, 8) + 0

and it should give you the exact same effect.


 I use PHP to access the mysql database so if MySQL can't do it, does 
 anybody know of a way to do it in combination with PHP?

If you decide to go this route, and I wouldn't since MySQL can do the 
work for you, make an array and put each record into an element of that 
array.  PHP has some very powerful array-sorting functions, check them 
out at php.net to see the best way to sort your data.  Most likely you'd 
do a similar thing as above in PHP, so why not just save the extra 
processing cycles by doing it in the database?


Erik





Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: table-building advice requested

2002-04-19 Thread Erik Price

Hi,

I am following up on a thread I started yesterday about building my 
tables.  (I have included the original email at the end of this one for 
reference.)  I got some good feedback about it, and so have decided to 
change my entire battle plan, and was hoping to get some advice about it.

The scenario is this:  a table exists called properfiles, and its 
columns keep track of various attributes of files.  Each record is a 
file, of course.  These files have been properly entered into the 
database using a PHP application I am writing, and thumbnails have been 
uploaded to the filesystem for each of these records.

A user can use the application to select any of these files to be 
printed, adding the files to a shopping-cart-like object.  But in 
addition to printing these already-existing files, the user needs to be 
able to define their own files to be printed -- these don't already 
exist in the database.  However, I would like to keep track of them, 
since they are being printed.

So here's the dilemma -- I've got some proper files that have been 
entered properly into the database, and have a great deal of 
information stored about them, and I have some user-entered files that 
have been entered only for the sake of being printed.  The attributes of 
a user-entered file are different from the attributes of a proper 
file.

Should I have one big table named files which keeps track of both 
kinds of files?  This seems dodgy to me -- that would mean that some 
columns would be for proper files (meaning that a user-entered file 
record would have a null value for that column) and some columns would 
be for user-entered files (so proper files would have a null value 
for that column).  Is this an acceptable database design?

Originally I was thinking of storing each in its own table -- 
properfiles and userfiles, and having a prints table act as a 
foreign key, storing one-to-many relationships between properfiles and 
userfiles (for each print there could be any combination of 
properfiles and userfiles).  But this would require having some way 
of tracking whether the file_id matches a proper file_id or a user 
file_id.  It doesn't seem very smart to have a setup like this.

So I think I should go with the big files table and just have some 
columns that apply to some kinds of files and not to others.  Is this 
done?  I'm just hesitant to have a lot of null values in my table.  What 
do you think?

Thanks for reading!  Thanks even more if you can help me.


Erik










On Thursday, April 18, 2002, at 03:52  PM, Erik Price wrote:

 Hello,

 I was hoping to solicit some advice on the structure of the database I 
 am building.  Here is a simplified version of my scenario:

 The application that I am designing, in PHP4.1.2 with MySQL (3.23.46 on 
 RedHat 7.2), has a feature which allows it to keep track of graphics 
 files (JPGs, GIFs, PSDs, AIs, QPTs, etc), which are stored on CDs in a 
 CD cabinet.  I have already designed a table to store information about 
 files, where each row is an individual file and each column is an 
 attribute of that file.

 mysql describe files;
 +-+---+--+-+-+
 | Field   | Type  | Null | Key | Default |
 +-+---+--+-+-+
 | file_id | int(10) unsigned  |  | PRI | NULL|
 | file_name   | varchar(64)   |  | | |
 | filetype_id | smallint(5) unsigned  | YES  | | NULL|
 | stor_id | mediumint(8) unsigned | YES  | | NULL|
 | file_size   | float(4,2)|  | | 0.00|
 | width_in| float(4,2)|  | | 0.00|
 | height_in   | float(4,2)|  | | 0.00|
 | file_res| smallint(5) unsigned  | YES  | | NULL|
 | cre_date| date  | YES  | | NULL|
 | insert_date | datetime  | YES  | | NULL|
 | inserter_id | smallint(5) unsigned  | YES  | | NULL|
 +-+---+--+-+-+
 (there are other tables that relate to this one, but they are not 
 relevant to my problem)

 Using my application via a web browser, users can select existing file 
 records which need to be printed, and store them as objects into an 
 array (actually a session variable array), similar to a shopping cart.  
 Later, they will use another section of the application to check out, 
 meaning each object in the array will become a row in another table 
 (printedfiles), representing files that have been selected to be 
 printed.  (What happens with this data is irrelevant to my problem)

 The problem comes into play here:  in addition to files they have 
 selected from the database (let's use the alias files since they are 
 all rows from the files table), users may also select files which do 
 not exist in the database yet -- let's use the alias user files.

 I do not wish to store user files

Re: Selecting Information Just Inserted

2002-04-19 Thread Erik Price


On Friday, April 19, 2002, at 02:10  PM, Andrew Kuebler wrote:

 I'm inserting data with an AUTO_INCREMENT column and immediately after I
 need to use that new number for a corresponding record in another table.
 How am I able to extract that new number quickly? I could run a SELECT
 query after the INSERT using the MAX command, but if at a busy time
 another record is entered while the first record was being entered, it's
 possibly I may get the wrong number. If there a way to use the INSERT
 command and extract the new AUTO_INCREMENT all in one command?

LAST_INSERT_ID() returns the last auto-incremented number for your 
database connection.  Yes, this means that even if you execute this and 
someone else has auto-incremented the table in the meantime, you will 
still have your auto-incremented number (not the new, higher one).  That 
is why this function is better than doing SELECT MAX() on that column.


Erik






Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




table-building advice requested

2002-04-18 Thread Erik Price

Hello,

I was hoping to solicit some advice on the structure of the database I 
am building.  Here is a simplified version of my scenario:

The application that I am designing, in PHP4.1.2 with MySQL (3.23.46 on 
RedHat 7.2), has a feature which allows it to keep track of graphics 
files (JPGs, GIFs, PSDs, AIs, QPTs, etc), which are stored on CDs in a 
CD cabinet.  I have already designed a table to store information about 
files, where each row is an individual file and each column is an 
attribute of that file.

mysql describe files;
+-+---+--+-+-+
| Field   | Type  | Null | Key | Default |
+-+---+--+-+-+
| file_id | int(10) unsigned  |  | PRI | NULL|
| file_name   | varchar(64)   |  | | |
| filetype_id | smallint(5) unsigned  | YES  | | NULL|
| stor_id | mediumint(8) unsigned | YES  | | NULL|
| file_size   | float(4,2)|  | | 0.00|
| width_in| float(4,2)|  | | 0.00|
| height_in   | float(4,2)|  | | 0.00|
| file_res| smallint(5) unsigned  | YES  | | NULL|
| cre_date| date  | YES  | | NULL|
| insert_date | datetime  | YES  | | NULL|
| inserter_id | smallint(5) unsigned  | YES  | | NULL|
+-+---+--+-+-+
(there are other tables that relate to this one, but they are not 
relevant to my problem)

Using my application via a web browser, users can select existing file 
records which need to be printed, and store them as objects into an 
array (actually a session variable array), similar to a shopping cart.  
Later, they will use another section of the application to check out, 
meaning each object in the array will become a row in another table 
(printedfiles), representing files that have been selected to be 
printed.  (What happens with this data is irrelevant to my problem)

The problem comes into play here:  in addition to files they have 
selected from the database (let's use the alias files since they are 
all rows from the files table), users may also select files which do 
not exist in the database yet -- let's use the alias user files.

I do not wish to store user files in the files table, because they 
are different entities.  But I would like to have these entities stored 
in the printedfiles table, along with any files that were selected 
using the application.  What is the best way to do this?  Originally, I 
was thinking that I could have a printedfiles.file_id column, which 
would store either the file_id of a files record, or the file_id of a 
userfiles record, depending on whether or not the printedfiles record 
was selected using the application or defined by the user.

But then I wondered if that was a good idea after all -- after all, how 
would I know whether the printedfiles.file_id was a files file_id or a 
userfiles file_id ?  To solve this, I thought I could add a column like

ALTER TABLE printedfiles ADD COLUMN source ENUM('files', 'userfiles')

to qualify the file_id as belonging to either a files record or a 
userfiles record.  But I am wondering if this is really a good idea -- 
when I need to query for all records in printedfiles and categorize 
them, will I be able to use this source column?  Or is there a better 
way I could be going about all of this...

Thanks for any insight you can provide.



Erik






Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




bumping up table values

2002-03-04 Thread Erik Price

I have a fairly straightforward problem, and I was hoping for some 
advice.  If anyone can come up with a more elegant solution to this 
problem, I'd be grateful.

I'm developing a small web-based PHP application.  One of its features 
is that users can go to a certain page, enter in some data about a bunch 
of files on a CD ROM, and then submit this information to a MySQL back 
end.  The data is simple string stuff like descriptions etc.

It's a multi-part form, and on the last page of the process, the data 
(temporarily stored in hidden variables) is re-displayed back to the 
user for confirmation.  Once the user hits Confirm, the SQL insert 
executes and the data is added.  No problem.

But one of the requirements is that the next page displays a label to 
the user, which is what tells the user how to label the CD.  This label 
is a simple two-part string of numbers, of the form 55:555.  The 
application itself must intelligently determine the appropriate label.  
The mechanism for doing this is simple -- the first two digits 
(prefix), before the colon, are determined by a dropdown list from the 
confirm page.  The hard part is the last three digits (base), after 
the colon.  The number that should appear is the next number in 
ascending order, depending on which prefix was selected.  This means 
that if 108 is the highest current base value in prefix 45, and the 
user chooses prefix 45 for this particular CD ROM, and submits the 
form, then the application must return the number 45:109 to the user in 
the next page.  Whereas, if the prefix that the user selects is 32, 
and prefix 32's highest base value is 12, then the returned number 
should be 32:013.  This seems easy to do with PHP, just query for the 
current MAX value of base WHERE prefix=$user_defined_prefix, and 
display this number + 1.

Of course, there is a catch.  This new, returned string is also an 
attribute of this record, and so needs to be stored somehow in relation 
to it (a one-to-one relationship).  I was thinking of creating this 
table:

mysql DESCRIBE storage;
+---+---+-+-++
| Field | Type  | Key | Default | Extra  |
+---+---+-+-++
| stor_id   | mediumint(8) unsigned | PRI | NULL| auto_increment |
| stor_pre  | smallint(5) unsigned  | | 0   ||
| stor_base | smallint(5) unsigned  | | 0   ||
+---+---+-+-++

and storing the stor_id as a column in the files table (where most of 
the file information is located).  Thus, part of the submit operation 
performed by the user will also be constructing a new SQL statement to 
insert a new prefix : base combination into this storage table.  In 
effect, this means that in the final part of my form, the following will 
happen:

1) database is queried for highest base value in user-defined prefix
2) this number is bumped up by one in PHP
3) this new base value is used in a new INSERT statement into the 
storage table, creating a new row (same prefix, new base)
4) PHP function mysql_insert_id() or MySQL function LAST_INSERT_ID() is 
used to take the stor_id value that was auto-incremented by step 3 and 
stores it in a temporary variable ($stor_id)
5) new INSERT statement to insert the descriptions of the files, using 
$stor_id as one of the values so that there is a relationship between 
the file and its location
6) Success message is echoed to the user, using the user-defined 
prefix and the new bumped-up base value, telling user what to label 
the CD (i.e., 45:109).

This seems like a lot of steps, and almost a kludge to me.  But then, 
this is the first web application I have written ever, and up until now 
all of the database work has been simple SELECT or INSERT or UPDATE 
statements -- nothing this big yet.  Is it normal to have a script that 
does all of this in different steps?  Could I make better use of MySQL's 
resources?

Thanks for your advice on these questions.


Erik







Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: another xml thread

2002-02-19 Thread Erik Price


On Monday, February 18, 2002, at 11:26  PM, Benjamin Pflugmann wrote:

 So, if you want to use data from a MySQL database and transfer it via
 XML and the other way around (i.e. XML as an transport layer for
 relational data), I see no particular problem for you to write a
 client that accomplishes that. But that doesn't touch major
 possibilities of XML.

 If you want to take data from XML documents and store them within
 MySQL, I see no way how that can be done reasonably.

I see.  I had not considered how more complex (and more tree-like) XML 
documents would be handled by the RDBMS.  I was thinking about my 
particular application, which is actually very simple, and would rely 
only on a single table (each column of the table would contain the 
content of a separate element in the XML file).  But now that I think 
about it, this is much more simple than some XML files will end up 
being, given their hierarchical structure.

So perhaps it's fine for my basic purposes, but not the best solution 
for complex XML documents.

 IIRC, the thread you cite was so long, because some (one?) of the
 people partiating did not know what they were talking, but kept
 insisting on their point. But I did not have a second look, so I am
 not sure if I am mis-remembering.

Yes, there was a lot of back-and-forthing.

Thanks,
Erik






Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




another xml thread

2002-02-18 Thread Erik Price

Hello everyone,

First let me apologize if this is a taboo topic.  I have been unsubbed 
from this list for a while, so I may be out of sync with convention.  If 
I should take this question elsewhere, please show me the door.

I'm interested in learning more about XML as a format for transporting 
data from one application to another.  I have access to a server running 
MySQL, which currently stores data concerning some graphics files used 
by my department.  I thought that it would be fun to use Python to 
develop a primitive client program and accompanying CGI scripts to see 
if I can automate some of the data entry that is normally done manually 
via a content-management site that I have been working on, and use XML 
as the transmission format.  Note that the purpose of this exercise is 
not so much functionality as it is self-improvement, so issues such as 
execution speed are not concerns of mine.

When I decided to look into combining MySQL with XML, I checked the 
archives for this list.  What I found was a 30+ message thread about 
whether or not XML data should be stored in a relational database, and 
the difference between the two storage schemas.  This is why I ask 
hesitantly: the thread was exactly a year old, and I am not sure if some 
of the opinions about this have changed.  After reading the thread, I 
feel somewhat more enlightened, but not fully convinced that XML is 
incompatible with RDBMS.  It strikes me that one is an excellent schema 
for storing and retrieving data, and the other is an excellent schema 
for structuring that data into a string or document destined for HTTP 
transmission.

Can anyone point me in the direction of an article or essay that they 
found particularly informative about this topic?  It is likely that I am 
barking up the wrong tree, but storing data in flat files doesn't seem 
to be the only way to use XML.

I don't plan on beginning this project for a couple of weeks at least, 
so it's not really important.  Again, if this is an inappropriate 
question for the list, send me packing.


Thanks,

Erik







Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




INSERTing duplicate values to a UNIQUE-indexed table

2002-02-04 Thread Erik Price

Hello, everyone.

I have a slight dilemma, and was wondering what the standard workaround 
is.  I have three tables: owners (auto_increment primary key is 
owners_id), objects (auto_increment primary key is objects_id), and 
owners_objects (which is a foreign key table that I created, under 
advice from someone on this list a while back whose email address has 
changed -- there are two columns in owners_objects: owners_id and 
objects_id, and there are two unique indexes on the table, 
owners_id / objects_id and objects_id / owners_id -- this is to keep 
duplicates combinations in this table, since they would only take up 
extra disk space).

I am designing an application in PHP which stores the relationship 
between an Owner and an Object using the owners_objects table in a 
many-to-many relationship.  When someone adds a new owner, they can 
choose from an HTML listbox any number of objects to associate with that 
owner.  The PHP code creates an INSERT statement that inserts the data 
into owners, and then takes the auto_incremented primary key of the 
last insert (which is the insert into owners) and uses that as the 
value for the second INSERT statemetn: to insert into 
owners_objects.owner_id.  In this second INSERT statement, the 
objects_id of the Object(s) selected from the listbox go into the 
second column of owners_objects.

I am sure that many people have done this sort of setup.  But what do 
you do to get around the problem of INSERTing a pair of values that 
already exist?  Because the combinations in owners_objects are UNIQUE 
(the UNIQUE indexes), MySQL won't accept a pair that is already 
present.  I see two possible options:

1) Check to see if the combination is already present, and if so, do not 
run the INSERT query
2) run the INSERT query regardless and suppress the error message

The disadvantage of the first one is that it adds an extra SQL query to 
the process.  The disadvantage of the second one is that I think it is 
somewhat tasteless to execute code that will knowingly error -- or 
should I just stop trying to be such a perfectionist?

I would post code but this is all pseudocode right now b/c I haven't 
solved this dilemma yet -- all experimentation with this has been done 
from the mysql client.

Thanks for your advice!


Erik


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: INSERTing duplicate values to a UNIQUE-indexed table

2002-02-04 Thread Erik Price


On Monday, February 4, 2002, at 01:48  PM, Marcus Collins wrote:

 You can use REPLACE instead of INSERT -- see the manual entry:

   
 URL:http://www.mysql.com/documentation/mysql/bychapter/manual_Reference.
 html#REPLACE


Thanks Marcus!  My knowledge of MySQL is pretty basic.  It has also been 
suggested that I use INSERT IGNORE (...) VALUES (...) -- my primitive 
powers of deduction tell me that this would create a tiny bit less load 
on the database, so I assume that this is probably the best course of 
action, unless I'm making a mistake about the way MySQL processes data.  
But now I know about both options!

Much appreciated,

Erik






Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: [PHP] Mac OSX !?!?!?

2002-01-17 Thread Erik Price

There is a utility called daemonic which is designed to deal with this 
as well, but works for more than just MySQL -- it's intended to be used 
for all server daemons.

http://daemonic.sourceforge.net/

It is Mac OS X-specific at this time, but according to the web site is 
designed for future compatibility with any operating system.  It can be 
installed via Fink (http://fink.sourceforge.net) very easily, and is in 
fact required by many Fink packages.

I must confess that I do not know much about it.

Erik



On Wednesday, January 16, 2002, at 08:01  PM, Richard Baskett wrote:

  Although the
 MySQL warnings, I got those because MySQL does not automatically start 
 in
 OSX, if you know it's started then Im not sure, but if not.. go here to 
 get
 the autostart utility:

 http://www.entropy.ch/software/macosx/mysql/


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




INSERTing into joined tables?

2002-01-09 Thread Erik Price

Hello, everyone --
I have received a great deal of help from many members of this list, so 
I'd like to acknowledge that now.  Someday, when I have my head wrapped 
around this stuff, I hope to return the favor.  In the meantime, 
however, I have come across my worst brainbuster yet.  Any help on this 
is greatly appreciated.


I constructed my tables in the most normalized way that I could 
(without overdoing it), so that in some cases, there is no -direct- 
relationship between tables.  That is, I have a table called people 
and a table called files, and a foreign key table called filespeople:

Database: medialab_db  Table: people
+-+--+--+-+
| Field   | Type | Null | Key |
+-+--+--+-+
| people_id   | smallint(5) unsigned |  | PRI | (auto-incremented)
| first_name  | varchar(36)  |  | |
| last_name   | varchar(36)  |  | |
+-+--+--+-+

Database: medialab_db  Table: files
+-+---+--+-+
| Field   | Type  | Null | Key |
+-+---+--+-+
| file_id | mediumint(8) unsigned |  | PRI | (auto-incremented)
| file_name   | varchar(64)   |  | |
+-+---+--+-+

Database: medialab_db  Table: filespeople
+---+---+--+-+
| Field | Type  | Null | Key |
+---+---+--+-+
| file_id   | mediumint(8) unsigned |  | PRI |
| people_id | smallint(5) unsigned  |  | PRI |
+---+---+--+-+

The relationship, in real life, is that I would like to establish 
many-to-many relationships between files records and people records, 
so that a record in files would be associated with several people from 
people.  There is a foreign key table called filespeople.  The SQL 
used to write a SELECT statement would use the join like so:

SELECT files.file_name, people.first_name, people.last_name
FROM files, people, filespeople
WHERE files.file_name = $filename
AND files.file_id = filespeople.file_id
AND people.people_id = filespeople.people_id
(the $filename variable is a user-selected variable, I'm using PHP)

So I designed my files and people tables without any direct 
relationship with one another, thinking to link them with the SELECT 
statement.

What I completely forgot, up until this point, was that I would need to 
INSERT these records (from pre-written HTML/PHP forms), and there is no 
WHERE clause in the INSERT statement to keep everything together.  In my 
scenario, a user might add a record to files and wish to associate 
that record to some of the records in people, either new or 
pre-existing (typed into an HTML text input form or something).  How 
should SQL code be arranged to link these records over the foreign key 
table?

INSERT INTO files (file_name) VALUES ($filename)

and

INSERT INTO people (first_name, last_name) VALUES ($firstname, 
$lastname)

but... to keep it all together... is lost on me... and then later to 
have UPDATE statements to do the same thing!  Although I suspect this 
may be easier as I can use the WHERE clause in an UPDATE statement.

If anyone has a link to a tutorial on this very concept, that would be 
greatly appreciated as well!


Thank you,
Erik


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: INSERTing into joined tables?

2002-01-09 Thread Erik Price


On Wednesday, January 9, 2002, at 03:06  PM, Rick Emery wrote:

 First, you are describing a one-to-many relationship, bceasue one 
 file
 record can be referenced by many people records.  If this is the 
 case, you
 may wish to re-design your tablse such that a people record contains a
 file_id field.  You can then do away with the filespeople table
 altogether.  Normalization is a good thing; but not when it is at the
 detriment of good design including how one processes it.

In this one example, it's true that it's one-to-many.  But in the 
database overall, there can be any number of files that correspond to 
any number of people.  In other words:

Joe, Lisa, Ryan, and Josh worked on File 1, File 2, and File 3
Gino only worked on File 1 and File 4
but Lisa helped him on File 4
etc

so, one person can have many files associated with them, and one file 
can have many people associated with them.

Which is why I constructed this with the foreign key.  I think it would 
be a lot easier if I could make it one-to-many!!  In any event, there 
are other relationships in the database that are also many-to-many, so I 
am curious what is the standard way to go about entering data into 
tables in a way that keeps them connected.

 If you do require the filespeople table, then you'll have to INSERT
 records programmatically with your favorite scripting (PHP,ASP,PERL)
 language or program language.

 FYI.  Your filespeople file indicates that both fields are PRIMARY 
 keys.
 That cannot be.  Only one field may be PRIMARY.  I just now tried it to 
 be
 certain.

Yeah, this is the way that mysqlshow outputs the data.  In reality, 
each column is a UNIQUE index (-not- a PRIMARY KEY).  For some reason, 
that's what mysqlshow gives instead of UNIQUE.

Thanks for the input, though!
Erik




 -Original Message-
 From: Erik Price [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, January 09, 2002 11:14 AM
 To: [EMAIL PROTECTED]
 Cc: Etienne Marcotte
 Subject: INSERTing into joined tables?


 Hello, everyone --
 I have received a great deal of help from many members of this list, so
 I'd like to acknowledge that now.  Someday, when I have my head wrapped
 around this stuff, I hope to return the favor.  In the meantime,
 however, I have come across my worst brainbuster yet.  Any help on this
 is greatly appreciated.


 I constructed my tables in the most normalized way that I could
 (without overdoing it), so that in some cases, there is no -direct-
 relationship between tables.  That is, I have a table called people
 and a table called files, and a foreign key table called 
 filespeople:

 Database: medialab_db  Table: people
 +-+--+--+-+
 | Field   | Type | Null | Key |
 +-+--+--+-+
 | people_id   | smallint(5) unsigned |  | PRI | (auto-incremented)
 | first_name  | varchar(36)  |  | |
 | last_name   | varchar(36)  |  | |
 +-+--+--+-+

 Database: medialab_db  Table: files
 +-+---+--+-+
 | Field   | Type  | Null | Key |
 +-+---+--+-+
 | file_id | mediumint(8) unsigned |  | PRI | (auto-incremented)
 | file_name   | varchar(64)   |  | |
 +-+---+--+-+

 Database: medialab_db  Table: filespeople
 +---+---+--+-+
 | Field | Type  | Null | Key |
 +---+---+--+-+
 | file_id   | mediumint(8) unsigned |  | PRI |
 | people_id | smallint(5) unsigned  |  | PRI |
 +---+---+--+-+

 The relationship, in real life, is that I would like to establish
 many-to-many relationships between files records and people records,
 so that a record in files would be associated with several people from
 people.  There is a foreign key table called filespeople.  The SQL
 used to write a SELECT statement would use the join like so:

 SELECT files.file_name, people.first_name, people.last_name
 FROM files, people, filespeople
 WHERE files.file_name = $filename
 AND files.file_id = filespeople.file_id
 AND people.people_id = filespeople.people_id
 (the $filename variable is a user-selected variable, I'm using PHP)

 So I designed my files and people tables without any direct
 relationship with one another, thinking to link them with the SELECT
 statement.

 What I completely forgot, up until this point, was that I would need to
 INSERT these records (from pre-written HTML/PHP forms), and there is no
 WHERE clause in the INSERT statement to keep everything together.  In my
 scenario, a user might add a record to files and wish to associate
 that record to some of the records in people, either new or
 pre-existing (typed into an HTML text input form or something).  How
 should SQL code

Re: Watchdog fĆ¼r mysql in Perl?

2002-01-04 Thread Erik Price

Well, you could use a shell script to run mysqladmin status.

I.e. this bash script:

#! /bin/bash

# mystatus.sh is really just a simple alias for a
# longer command.

# Usage: 'mystatus.sh PASSWORD'

# replace values of $my_hostname and $my_username if needed
my_hostname='localhost'
my_username='root'
my_password=${1}
export my_hostname my_username my_password

# execute the command
/usr/local/mysql/bin/mysqladmin -h $my_hostname -u $my_username \
 --password=$my_password status

# end of file

I tested this out with variables corresponding to my own system, I'm 
running RH Linux with MySQL 3.23.46.  You don't even have to replace the 
values in the variables section of the script with your own, if your 
MySQL server is on the localhost.  The setup as is takes the password 
from STDIN, so it's not stored anywhere (though I don't know how to 
write a script that hides the password as you type it [yet]).  I'm 
sure that you could do a better script than this in Perl, which I don't 
yet know.

I'm still learning how to write bash scripts (this is my second one that 
does anything useful) so if this code is amateurish, sorry.

Erik





On Friday, January 4, 2002, at 06:52  AM, Sascha Kettner wrote:

 Hi!

 Short question: i want to have a perl watchdog telling me when executed
 if my sql-server is running and if anything is allright with it. So if i
 get any errormessage i can restart the server by remote. Has someone
 done this allready? Any hint?

 Thanks again and best regards

 Sascha Kettner


 -
 Before posting, please check:
http://www.mysql.com/manual.php   (the manual)
http://lists.mysql.com/   (the list archive)

 To request this thread, e-mail [EMAIL PROTECTED]
 To unsubscribe, e-mail mysql-unsubscribe-
 [EMAIL PROTECTED]
 Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




ENUM -- integers or strings?

2002-01-04 Thread Erik Price

A quick question --

If I have a table with an ENUM column, and the possible values are (0, 
1, 2, 3), does the number qualify as an integer or a string?

I am working in PHP4 and intend to compare this value as such:

// dbaccess.access_level is ENUM(0, 1, 2, 3) column
// $user_id has been established already

?php
// get the access level for the user based on their ID
$sql = SELECT dbaccess.access_level
FROM dbaccess, users
WHERE $user_id = users.user_id
AND users.dbaccess_id = dbaccess.dbaccess_id  ;
$result = mysql_query($sql, $db) ;
$access_level = $result ;

// generate page content according to the user's access level
switch ($access_level) {
case $access_level  2 :
// generate HTML + PHP page giving user
// ability to SELECT, INSERT, UPDATE, or
// DELETE from tables.  Finish page, then
break ;
case $access_level  1 :
// generate HTML + PHP page giving user
// ability to SELECT or INSERT from/to
// tables.  Finish page, then
break ;
case $access_level  0 :
// generate HTML + PHP page giving user
// ability to SELECT from tables.
// Finish page, then
break ;
default :
// print You cannot access this
// information. Finish page.
} ;

Sure, the question is really quick (whether or not ENUM returns an 
integer or string), but now that I think about it, does it really matter 
for the purposes of my example here?  Wouldn't this PHP code be able to 
take a string or an integer as an argument to the switch statement?

Thanks for any advice anyone can give!


Erik


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: ENUM -- integers or strings?

2002-01-04 Thread Erik Price

There's no data in the database yet, so I haven't tested this code.  I 
don't want to use the mysql CLI client to input data b/c the data is 
spread out over a number of tables, rather, I'm writing PHP pages that 
provide a means to populate the database in an organized way.  But until 
the PHP is done, I can't test... conundrum?

Erik


On Friday, January 4, 2002, at 03:07  PM, Rick Emery wrote:

 What happened when you experimented?  What were your results?

 -Original Message-
 From: Erik Price [mailto:[EMAIL PROTECTED]]
 Sent: Friday, January 04, 2002 2:03 PM
 To: [EMAIL PROTECTED]
 Subject: ENUM -- integers or strings?


 A quick question --

 If I have a table with an ENUM column, and the possible values are (0,
 1, 2, 3), does the number qualify as an integer or a string?

 I am working in PHP4 and intend to compare this value as such:

 // dbaccess.access_level is ENUM(0, 1, 2, 3) column
 // $user_id has been established already

 ?php
 // get the access level for the user based on their ID
 $sql =   SELECT dbaccess.access_level
   FROM dbaccess, users
   WHERE $user_id = users.user_id
   AND users.dbaccess_id = dbaccess.dbaccess_id  ;
 $result = mysql_query($sql, $db) ;
 $access_level = $result ;

 // generate page content according to the user's access level
 switch ($access_level) {
   case $access_level  2 :
   // generate HTML + PHP page giving user
   // ability to SELECT, INSERT, UPDATE, or
   // DELETE from tables.  Finish page, then
   break ;
   case $access_level  1 :
   // generate HTML + PHP page giving user
   // ability to SELECT or INSERT from/to
   // tables.  Finish page, then
   break ;
   case $access_level  0 :
   // generate HTML + PHP page giving user
   // ability to SELECT from tables.
   // Finish page, then
   break ;
   default :
   // print You cannot access this
   // information. Finish page.
 } ;

 Sure, the question is really quick (whether or not ENUM returns an
 integer or string), but now that I think about it, does it really matter
 for the purposes of my example here?  Wouldn't this PHP code be able to
 take a string or an integer as an argument to the switch statement?

 Thanks for any advice anyone can give!


 Erik


 -
 Before posting, please check:
http://www.mysql.com/manual.php   (the manual)
http://lists.mysql.com/   (the list archive)

 To request this thread, e-mail [EMAIL PROTECTED]
 To unsubscribe, e-mail mysql-unsubscribe-
 [EMAIL PROTECTED]
 Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

 -
 Before posting, please check:
http://www.mysql.com/manual.php   (the manual)
http://lists.mysql.com/   (the list archive)

 To request this thread, e-mail [EMAIL PROTECTED]
 To unsubscribe, e-mail mysql-unsubscribe-
 [EMAIL PROTECTED]
 Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




mysqlshow expands my argument

2002-01-02 Thread Erik Price

I'm trying to use mysqlshow to display the tables of a database on a 
remote host.  I enter the command:

localhost:/usr/local/mysql$ ./bin/mysqlshow -h 555.55.5.5 -p samp_db
Enter password:
Wildcard: samp_db
+-+
|  Databases  |
+-+
| samp_db |
+-+
localhost:/usr/local/mysql$

I'm curious as to why mysqlshow does not display the contents of the 
database samp_db -- both the man page for mysqlshow and the book I'm 
reading suggest that if I supply a database name as an argument, the 
tables of that database are shown.  Why is mysqlshow treating my 
argument as a wildcard for filename expansion?

Thanks for any help.


Erik


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




an example INSERT statement

2002-01-02 Thread Erik Price

Hello,

I'm having some trouble constructing my first INSERT statement into 
multiple tables.  I'm using PHP4.  I have written the following INSERT 
statement with no problems:

$sql = INSERT INTO main (name, ext, stor_pre, stor_base, width, height, 
file_size, proj_id, date_cre, cre_by, division) VALUES ('$name', '$ext', 
'$stor_pre', '$stor_base', '$width', '$height', '$file_size', 
'$proj_id', '$date_cre', '$cre_by', '$division');

This inserts the variables as values into the designated columns of the 
table main.

But I have expanded my database, restructuring it so that it no longer 
uses one table (main).  These various columns are now distributed 
across five different tables.  If I were to SELECT data from these 
tables, I would use a join statement.  How would I go about writing an 
INSERT statement that joins several different tables together?  Even a 
pointer to where I can find this info would be helpful.  The INSERT 
syntax page in the official documentation 
(http://www.mysql.com/doc/I/N/INSERT.html) doesn't address this specific 
circumstance, or if it does then I'm too dense to figure it out.

Thanks!


Erik


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: are my queries bloated?

2001-12-10 Thread Erik Price


On Saturday, December 8, 2001, at 12:53  PM, Arjen G. Lentz wrote:


 Re-order the list of tables in the FROM, and put the
 subprojectweb.subproject_name = 'shoeshine.com'  bit first
 after the WHERE, that will also make it clearer for you to read.

 Is this just for my own personal clarity?  I was under the impression
 that the exact order of the JOINs wouldn't matter very much, but I
 haven't found any evidence of this yet.

 Join order *does* matter, the table with the search criteria should 
 generally
 be checked first, most limiting the number of rows. Then the other 
 tables are
 joined into the result using their foreign keys. You don't want te 
 query to be
 performed based on the foreign keys, with the search criteria being 
 applied
 last!

I didn't realize that the order of JOIN statements mattered...

 For a regular join with commas, the optimiser will try to work out an 
 optimal
 join order. However, you will need to have a look at the output from 
 EXPLAIN,
 which will show the tables in the order they are joined. If it is
 non-optimial, you could modify your query by using STRAIGHT_JOIN or 
 other
 tricks to get an optimal join order.

... but now I feel like I have a better grasp of how it works.  I guess 
the best thing to do is just examine the results of the EXPLAIN.

 Thanks very much for responding to my questions about this, Arjen.

 You're quite welcome.
 This kind of stuff (optimising) is an important subject in MySQL 
 training
 courses (www.mysql.com/training/).

I wish!  At some point in the future my organization might grant me that 
kind of benefit, but for the time being I'm just an office temp who is 
having a hard enough time trying to justify his project!!  Basically, I 
proposed this project because I wanted to learn more about 
database-driven web applications using MySQL and PHP and because my 
organization needed a way to keep track of projects and image files.  I 
really am hoping to take this to a new level eventually, a sort of 
web-based workspace that will include message boards and other 
functionality to keep all of the users in touch.

I would love to take a class on this subject!


-- Erik


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: just moved from windows to linux mysql

2001-12-06 Thread Erik Price

On Thursday, December 6, 2001, at 02:15  PM, Curtis Gordon wrote:

 Hi, I have just setup a dedicated linux/php/mysql dev box in my office 
 and I am gearing up to move my databases from a windows box to the 
 linux box. There are a couple of things I would like to be clear on 
 before I start.

Good move.

 1) when I am logged into linux as user1 and I create a database, does 
 this mean that my username and password for the database will be the 
 same as the linux login, or do you have to set username and password 
 when you are creating the database?

Some people are confused by the way MySQL keeps track of users because 
MySQL also features a user called root (like in Unix/Linux).  But be 
assured that you must create your users in MySQL (using GRANT commands) 
separate from your Unix/Linux users.  For sake of ease, you can use the 
same names, but you don't have to.  If you're in Linux, logged in as 
User1, you can log in to MySQL as User55 like this:

$ bin/mysql -u User55 -p samp_db

or you can just let the mysql client program assume that you want to log 
in to MySQL under the same name as your current Linux username (User1) 
like this:

$ bin/mysql -p samp_db

see?  Omit the -u argument and the mysql client uses your Unix/Linux 
username as the MySQL username.  Note that the -p flag is optional if 
you do not have a password set for that particular MySQL account.

 2) can somebody, anybody offer up some links to a quicky tutorial on 
 loading a database with existing data, and backing up an existing 
 database. I don't mean the ones in the mysql manual, I am looking for 
 more of a made for dorks like me version.

MySQL by Paul DuBois (New Riders).  Sorry I don't have a web 
reference, but this book is very helpful.



Erik


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: are my queries bloated?

2001-12-06 Thread Erik Price

I haven't populated this database yet.  There are actually many more 
columns, this was kind of a rough draft -- I only featured the ones that 
I needed to see if my JOINs were okay.  I just got a little nervous when 
I drafted a few sample queries and saw that much text !!

That makes me feel much relieved, thanks Rodney.  I suppose there's 
nothing wrong after all but, it seemed like a lot of joins (more than I 
see in other examples).  I guess I will get started with the PHP !!!

-- Erik


On Thursday, December 6, 2001, at 06:05  PM, Rodney Broom wrote:

 What you've got looks fine to me. Joins like this are not uncommon at 
 all. I wonder, where is your concern with this? Is it in how much text 
 you've typed to create a query, or is the query itself actually running 
 slowly?


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: [PHP] Mac OSX and MySQL

2001-12-05 Thread Erik Price


On Wednesday, December 5, 2001, at 12:24  AM, RenƩ Fournier wrote:


 I have to create a MySQL for my PHP scripts. How do I do this in Mac 
 OSX? There are a bunch of command line tools, but I'm not sure which 
 one[s] to use.


Well, if you already have MySQL installed, then just use them as 
normal.  Just remember that Unix syntax is different from DOS (lets you 
do more, actually).

If you need to install MySQL, try these:

http://developer.apple.com/internet/macosx/osdb.html

the above link is for Apple's own recommendations for installing MySQL 
on Darwin.  Just make sure that you use the source code for 3.23.45, not 
3.43.44 (because the .44 doesn't shut down properly in Darwin).  I used 
this technique (not the binary) and it works great.

http://fink.sourceforge.net

if you use Fink (debian-style package installer) you can have it install 
MySQL for you (as well as PHP and Apache) but I didn't go this route 
because I wanted more control over the install process.

http://www.stepwise.com/Articles/Workbench/2001-10-11.01.html

the above link isn't for MySQL at all, it's for PHP, but it's a useful 
article.  Remember to add the --with-mysql configure option because 
this tutorial doesn't assume that you want to install MySQL.

Any questions, email me.


Erik


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: [PHP] Re: Mac OSX and MySQL

2001-12-05 Thread Erik Price

Oh, okay, you want to know how to use NetInfo.

Do man niutil and read the man pages on niutil.  Also very useful, in 
the following link is a brief description of how to use NetInfo Manager 
to do the same thing if you prefer GUI:

http://developer.apple.com/internet/macosx/osdb.html


It tells you how to create a user.

Erik

PS: don't use System Preferences' Users to make dummy users for MySQL 
and other services.



On Wednesday, December 5, 2001, at 10:04  AM, RenƩ Fournier wrote:

 I have to create a MySQL for my PHP scripts. How do I do this in Mac 
 OSX? There are a bunch of command line tools, but I'm not sure which 
 one[s] to use.

 Not sure I understand this question.  What do you mean by create a 
 MySQL for my PHP?

 oops, I meant to write create a MySQL user for my PHP scripts. In 
 other words, when my scripts try to connect to the database, they need 
 to supply a user id and password (and that must be certain id/pwd to 
 correspond with the 'real' online server we're using). So I would like 
 to know how to create this user/password under Mac OSX. (Thanks.)


 Thanks.

 ...Rene

 Hope this helps,

 /Rob

 ~
 Robert Alexander, Alpha Geek, Workmate.ca
 WWW Database Applications and Web Hosting
 http://www.workmate.ca   416-823-6599
 mailto:[EMAIL PROTECTED]

 Life's unfair - but root password helps!

 -
 Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

 To request this thread, e-mail [EMAIL PROTECTED]
 To unsubscribe, e-mail mysql-unsubscribe-
 [EMAIL PROTECTED]
 Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



 ---
 RenƩ Fournier
 [EMAIL PROTECTED]


 -- PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: more than one possible column value

2001-12-04 Thread Erik Price

I understand now.

There needs to be a table in between files and types.  This allows 
me to assign two different rows in the types table (say, JPG and JPEG) 
to the same row in the files table, or two different rows in the 
files table to the same row in the types table.

This seems like quite an extra step.  I am prepared to do it if that is 
what must be done -- let me guess:  it's not that hard if you are 
careful to construct SELECT, INSERT, and UPDATE statements that JOIN the 
three tables together in the proper combination!

Okay, I will just have to be very careful about that (this project was 
much easier when the relationships were all one-to-one !!  :-)  .

Thank you very much for your help, Etienne.


-- Erik



On Tuesday, December 4, 2001, at 01:23  PM, Etienne Marcotte wrote:

 hum I have an hard time understanding, but if I'm right:

 CREATE TABLE files(
 fileID smallint unsigned auto_increment,
 filename varchar(36) not null,
 primary key (fileID)
 )

 CREATE TABLE types(
 typeID smallint unsigned auto_increment,
 typename varchar(36) not null,
 typeext char(4) not null unique,
 primary key (typeID)
 )

 You'll need a third table linking the two (because it will be a N:N
 relationship) A file may have many extensions and an extension may have
 many files.

 CREATE TABLE filetypes (
 fileID smallint unsigned not null,
 typeID smallint unsigned not null,
 unique index (fileID,typeID),
 unique index (typeID,fileID)
 )

 Now insert some dummies

 mysql select * from files;
 ++--+
 | fileID | filename |
 ++--+
 |  1 | foo  |
 |  2 | bar  |
 |  3 | baz  |
 ++--+
 3 rows in set (0.00 sec)

 mysql select * from types;
 ++-+
 | typeID | typename|
 ++-+
 |  1 | photoshop image |
 |  2 | word document   |
 |  3 | excel sheet |
 |  4 | jpeg image  |
 |  5 | jpeg image  |
 ++-+
 5 rows in set (0.00 sec)

 Now let's say you have an image that can have either jpeg or jpg:

 mysql select * from filetypes;
 +++
 | fileID | typeID |
 +++
 |  3 |  1 |
 |  1 |  2 |
 |  2 |  4 |
 |  2 |  5 |
 +++
 5 rows in set (0.00 sec)

 mysql SELECT filename, typename, typeext FROM files, types, filetypes
 WHERE filetypes.fileID = files.fileID AND filetypes.typeID =
 types.typeID AND filename LIKE bar;
 +--++-+
 | filename | typename   | typeext |
 +--++-+
 | bar  | jpeg image | jpg |
 | bar  | jpeg image | jpeg|
 +--++-+
 5 rows in set (0.00 sec)

 I hope it's what you wanted

 Etienne

 btw, if you find any mailing list ont he web for general relational DB
 design issues, let me know. I searched and could not find any:(

 Erik Price wrote:

 Hello,

 I was looking for some advice on building my database.  If this is an
 offtopic question, I apologize in advance!

 I'm building a database with several tables.  Only two of them pertain
 to my question.  Also, as I have not yet built my tables (I'm planning
 them), I can't include contents of a dump.

 One of the tables is called files, the other is called types.  Here
 is a quick sketch of what files looks like (there is more but this is
 really all that matters):

 +-+---+-+
 | file_id | file_name | type_id |
 +-+---+-+
 | |   | |
 | |   | |
 | |   | |
 | |   | |
 +-+---+-+

 here is types:

 +-+---+-+
 | type_id | type_name | ext |
 +-+---+-+
 | |   | |
 | |   | |
 | |   | |
 | |   | |
 +-+---+-+

 You can probably figure out what I'm doing here.  file_id and type_id
 are INTEGER-based primary keys which simply give me a nice reference
 number to give each row. file_name and type_name are VARCHAR(36)
 columns.  files.type_id is really the same as types.type_id, and
 types.ext is a VARCHAR(5) column.  Queries will look like this:

 SELECT files.file_name
 FROM files, types
 WHERE types.ext LIKE txt
 AND files.type_id = types.type_id ;

 So that a user can enter txt as a file's extension and all the files
 that are .txt files will be returned.

 First of all, I hope I'm doing this right.

 Second of all -- some files types (file formats) have more than one
 extension.  For instance, I write HTML files and use JPEGs.  But
 sometimes I'll use a graphics program that automatically renames the
 file .JPG and I won't change it because it's too much of a pain.  Or
 someone I work with might have use Windows, and instead of writing a
 .html file, they may have their extension as .htm (the l is missing).

 What

Re: more than one possible column value

2001-12-04 Thread Erik Price

On Tuesday, December 4, 2001, at 01:23  PM, Etienne Marcotte wrote:

 CREATE TABLE filetypes (
 fileID smallint unsigned not null,
 typeID smallint unsigned not null,
 unique index (fileID,typeID),
 unique index (typeID,fileID)
 )

One question, though.  Do I have to construct indexes in both 
directions?  I haven't used the UNIQUE INDEX command.  I still have much 
to learn -- I'm only partway through the DuBois book that I am using to 
learn MySQL.  The chapter on optimizing databases and indexing is next.

Well, no need to respond to that.  I will study further before asking 
any more questions.





Erik


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: mySQL in-memory configuration

2001-12-03 Thread Erik Price

I'm not sure, but you'd be in big trouble if your system lost power!


-- Erik



On Monday, December 3, 2001, at 10:50  AM, Banach, Timothy P wrote:

 Hello,

 Can mySQL be configured to run entirely in-memory? That is, can one
 configure it so that all the tables, data, etc. remain resident in 
 memory
 and are never written to disk?

 TIA,

 Tim Banach


 -
 Before posting, please check:
http://www.mysql.com/manual.php   (the manual)
http://lists.mysql.com/   (the list archive)

 To request this thread, e-mail [EMAIL PROTECTED]
 To unsubscribe, e-mail mysql-unsubscribe-
 [EMAIL PROTECTED]
 Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: How To Install Under MacOS X?

2001-11-30 Thread Erik Price

Also, although the standard groupadd command doesn't work for adding 
groups, you can use NetInfo Manager to add a group.  This gives you a 
GUI interface to managing your groups and users.  If you don't like GUI, 
use the command line tool niutil, which has its own man page.

You would probably like this link, because it's the Apple-sanctioned way 
to install MySQL onto OS X.  It includes a brief description of how to 
use NetInfo, as well, so you will find it useful even if you don't care 
about installing MySQL.  The only problem is that it does not mention 
that 3.23.44 has a problem shutting down properly on Mac OS X (just use 
3.23.45 because all the steps are the exact same and it doesn't have 
this problem).

http://developer.apple.com/internet/macosx/osdb.html

BTW, don't be intimidated by the prospect of compiling source code.  I 
used to think that was hard core, but now I prefer it over the GUI or 
binary installs.

Feel free to contact me directly if you have a problem, I just got MySQL 
up and running on Mac OS X the other day.


--Erik



On Thursday, November 29, 2001, at 08:29  PM, Kundan Kumar wrote:

 Try installing by fink..

 http://fink.sourceforge.net/

 If you have worked on debian, you will appreciate it.

 Regards,
 Kundan



 On 11/30/01 12:13 AM, Kurt Tappe [EMAIL PROTECTED] wrote:

 I'm stuck trying to figure out how to install this thing.  What I've 
 tried:

 * The download doesn't contain a standard MacOS .pkg so I can't do a 
 GUI
 install.

 * The command-line instructions require the groupadd command in step 
 #1, but
 MacOS doesn't support this due to the existence of the NetInfo system.

 * Turning to the manual.html included in the MacOS X build, only 
 Linux and
 Windows are mentioned.

 Can anyone who has successfully installed MySQL under MacOS X tell me 
 how they
 did so??

 Thanks,
 -Kurt


 -
 Before posting, please check:
http://www.mysql.com/manual.php   (the manual)
http://lists.mysql.com/   (the list archive)

 To request this thread, e-mail [EMAIL PROTECTED]
 To unsubscribe, e-mail mysql-unsubscribe-
 [EMAIL PROTECTED]
 Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Designing a database to track files

2001-11-30 Thread Erik Price

Hello,

I'm designing a database, and of course I have no formal training in 
this area (I'm learning from DuBois's book).  It's designed to keep 
track of files.  In my organization, we have a small design studio, and 
the designers save their image files to CD-ROMs.  As you can imagine, 
the stacks of CDs have gotten so high that we now have invested in a 
large CD-storage cabinet.  Needing a way to organize these files 
somehow, I was assigned the job of finding a database and setting it 
up.  Having always wanted to get some experience in database-driven 
web-applications, I have decided to take advantage of this opportunity 
and learn PHP and MySQL.  Those of you who have seen me post to this 
list with installation questions and have helped me, I thank you.  Now 
it's time to design the database.

I have come up with a few tables and am going to create them, but I 
can't help but feel like my setup is flawed somehow.  We don't have very 
high standards for this project, but I would like it to be the best 
possible and it is a learning exercise for me, so I want to use the best 
possible design from the very beginning.  Instead of just listing my 
whole table setup and asking for input (which seems kind of 
presumptious, though I wouldn't mind any advice), I'll describe my 
specific situation:

I have two separate tables.  One of them is called files and the other 
is called divisions.  There are more tables, of course, but these are 
the only ones that matter in this case.  My organization is divided into 
twelve divisions at this time, and I have assigned the  name of a 
division to each row in the divisions table, along with some other 
irrelevant information like contact info, et cetera.  divisions has an 
AUTO_INCREMENT PRIMARY KEY TINYINT column as well, so that I can refer 
to these entries by their identification number instead of by name.  The 
column is called div_id, and can be referred to as divisions.div_id.

In the files table, each row corresponds to a separate file.  There's 
all sorts of additional criteria, but the only one that matters to my 
question is the column called div_id.  That's right, the number in 
files.div_id must always correspond to the number in 
divisions.div_id.  You might ask why I don't just use the division 
name in the files.div_id column -- it would seem to make more sense to 
have the column set up as

div_id ENUM(division1, division2, division3, etc...)

The reason why I am hesitant to do this is because I don't want someone 
to have to use MySQL to do this:

ALTER TABLE files CHANGE div_id div_id ENUM(division1, division2, 
division3, ... new_division)

I would like to make this database as self-maintaining as possible.  If 
files.div_id is an INTEGER, rather than an ENUMERATION, then the user 
only has to use a new number that is one number higher than the old 
highest number, if we were to create add a new division to the 
organization.

So does this setup seem to make sense?  I mean, all I'm doing is using 
an INTEGER rather than an actual name to identify a division.  That 
seems like it would make sense.

Here's the problem:  no one wants to identify the divisions by numbers.  
If they are to perform a search of files that were created by a specific 
division, then they want to input the division's name, not a number.  Is 
there a way to use MySQL to translate the integer divisions.div_id to 
divisions.div_name ?  I guess what I'm asking is if this query is 
possible:

SELECT files.file_name
FROM files
WHERE files.file_id = divisions.div_id
AND divisions.div_name = division1 ;

I don't think this is a real SQL query, but I think it describes what 
I'm trying to do here, I made a little diagram (this isn't output from 
mysql):

+--+
| files|
+-+---++
| file_id | file_name | div_id |
+-+---++
| 32  | picture1  | 08 |
| |   ||
| |   ||
| |   ||
| |   ||
+--+

++
| divisions  |
++---+---+
| div_id | div_name  | contact info, etc |
++---+---+
| 08 | division1 | 123 Main St, etc  |
||   |   |
||   |   |
||   |   |
||   |   |
++---+---+

I'm trying to give the name division1 and get the name picture1 back.

Will this work?  If so, that is heartening, because I plan to have 
several other tables in the database (for other criteria) which will 
work in the same fashion (by assigning each entry an INTEGER rather than 
a name).


Thanks,

-- Erik
the office temp who was told to design
a database and write a web front-end,
with no experience in 

Re: Designing a database to track files

2001-11-30 Thread Erik Price

Jens,

That is great news!  You've made my day -- that means that the rest of 
my tables should work with JOIN queries, as I am building them along the 
same model -- using ID numbers instead of actual names to connect to the 
main files table.  Thanks for clearing that up for me.

And also for the tip about using single ticks.

Sincerely,


Erik


On Friday, November 30, 2001, at 01:53  PM, Jens Vonderheide wrote:

 That's nearly correct. You could use

 SELECT files.file_name
 FROM files, divisions
 WHERE files.file_id = divisions.div_id
   AND divisions.div_name = 'divisions1';

 Note that both tables you wish to include in the query need to be 
 written
 after the FROM command. This type of query is called a JOIN.


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: Please redo this horrible web page

2001-11-28 Thread Erik Price


On Wednesday, November 28, 2001, at 02:44  PM, john wrote:

 pages every day. Things on the list are no way near how easy they can 
 be. I
 cannot fathom why this is not a newsgroup, and why every person/eu has 
 to be
 flooded with so much email that has nothing to do with them or their
 queries. Mailing lists just seem stupid to me. Someone please help me to
 understand why we are being subjected to so much email, when this could 
 just
 be a posting, and we review the postings.

You are not being subjected to so much email.  You chose to subscribe to 
this list knowing full well what that would mean and I'm sure you know 
how to unsubscribe.  There's a digest if you can't handle it, or filter 
your email to an appropriate box.  I delete threads whose subject lines 
don't interest me, it's really not that hard.

And what is this I won't read any email from those who do not have 
'mysql.com' in their email addresses?  That seems mighty entitled.  If 
you want customer support, I think MySQL AB will be happy to provide it, 
go to https://order.mysql.com/ .  Please note that, although they have 
provided the documentation, mailing list, archives, and the software 
itself for FREE, this is something that you can pay for.

You know, your suggestions are actually helpful, but the tone with which 
you deliver them invalidates you as a constructive critic.  I think they 
call that sort of person a troll.

Erik


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: Please redo this horrible web page

2001-11-28 Thread Erik Price

John,

I know what you mean, to some extent.  I bought a recently-published 
book that served as an introduction to MySQL and PHP.  I thought it 
would be perfect -- it seemed to be engagingly written, and specifically 
dealt with what I wanted to learn about.  The only problem was that the 
editing was terrible.  Typos, grammar mis-uses, and worst of all, the 
code did not match the diagrams or even the text of the book in some 
cases.  It would have been fine for someone who already has a foundation 
in MySQL or PHP, but for someone starting from scratch, it was worthless.

We all know computer books aren't inexpensive.  They cost usually $30 
(US) minimum, and often as much as $35-40 for a good one.  I can't speak 
for everyone, but that pretty much puts me back a few when I plunk down 
the bucks and it's not worthwhile.  So I took the book back to the store 
and spent a few more dollars to get a book that was heavily recommended 
by the MySQL site book reviewers.  I can honestly say that I'm very 
satisfied with the purchase.

What happened here was I spent some money on a product that wasn't 
worthwhile, and then I did something about it.  I got my money back, and 
found a better way to spend it.  So, while I can understand your 
frustration, I guess that begs the question -- do you want your money 
back?

Erik





On Wednesday, November 28, 2001, at 04:29  PM, john wrote:

 Erik,

Thanks for your input. I had no idea of what a troll was. I have 
 seen the
 term flung about before, but I had no idea I was being a troll. So, a 
 person
 who just sends an email to a list that has a valid complaint is not a 
 troll,
 but if they send it with an attitude, because they are frustrated at the
 lack of adequit documentation accompanying the program, that's what 
 makes
 them trolls. I see.

 I read the Manual all the time. The misspellings, mismatched '  's and
 overwhelming use of the _ make the Manual hard to follow sometimes. Is 
 that
 intended to be an underscore or a space, I ask again and again and 
 again?

 john


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




PHP install w/MySQL difference question

2001-11-27 Thread Erik Price

Hello,

[The contents of this email contain quite an annoying amount of output 
from the command line, but please note that I have deleted most of the 
unnecessary output and tried to comment the parts that I felt were 
necessary.]

I am curious as to what the difference will be if I choose to install 
PHP4 with MySQL functionality, using only the built-in MySQL support.  
If I specify the /path/to/mysql in my ./configure option --with-mysql, 
then I get the following output:

localhost:~/tmp/apache_mod_php-6-2/php$ ./configure --with-xml 
--with-zlib --with-apxs=/usr/sbin/apxs --with-mysql=/usr/local/mysql
creating cache ./config.cache
... ( for sake of space, most ./configure output omitted ) ...

Generating files
checking for working mkdir -p... yes
creating config_vars.mk
updating cache ./config.cache
creating ./config.status
creating php4.spec
creating Zend/Makefile
creating main/build-defs.h
creating pear/scripts/pear
creating pear/scripts/phpize
creating pear/scripts/php-config
creating TSRM/Makefile
creating main/php_config.h
creating sapi/Makefile
creating ext/Makefile
creating Makefile
creating pear/Makefile
creating main/Makefile
creating ext/zlib/Makefile
creating ext/mysql/Makefile
creating ext/pcre/Makefile
creating ext/pcre/pcrelib/Makefile
creating ext/posix/Makefile
creating ext/session/Makefile
creating ext/standard/Makefile
creating ext/xml/Makefile
creating ext/xml/expat/Makefile
creating ext/xml/expat/xmlparse/Makefile
creating ext/xml/expat/xmltok/Makefile
creating sapi/apache/Makefile
creating regex/Makefile
creating number.c
creating number.h
creating main/internal_functions.c
++
| License:   |
| This software is subject to the PHP License, available in this |
| distribution in the file LICENSE.  By continuing this installation |
| process, you are bound by the terms of this license agreement. |
| If you do not agree with the terms of this license, you must abort |
| the installation process at this point.|
++

Thank you for using PHP.

localhost:~/tmp/apache_mod_php-6-2/php$



But when I 'make' PHP, I get the following warnings (after it is done 
compiling):



*** Warning: This library needs some functionality provided by 
-lmysqlclient.
*** I have the capability to make that library automatically link in when
*** you link to this library.  But I can only do this if you have a
*** shared version of the library, which you do not appear to have.

*** Warning: This library needs some functionality provided by 
-lmysqlclient.
*** I have the capability to make that library automatically link in when
*** you link to this library.  But I can only do this if you have a
*** shared version of the library, which you do not appear to have.

*** Warning: libtool could not satisfy all declared inter-library
*** dependencies of module libphp4.  Therefore, libtool will create
*** a static module, that should work as long as the dlopening
*** application is linked with the -dlopen flag.
~/tmp/apache_mod_php-6-2/php/.libs/libphp4.lax/libZend.al
~/tmp/apache_mod_php-6-2/php/.libs/libphp4.lax/libsapi.al
~/tmp/apache_mod_php-6-2/php/.libs/libphp4.lax/libmain.al
~/tmp/apache_mod_php-6-2/php/.libs/libphp4.lax/libregex.al
~/tmp/apache_mod_php-6-2/php/.libs/libphp4.lax/libzlib.al
~/tmp/apache_mod_php-6-2/php/.libs/libphp4.lax/libmysql.al
~/tmp/apache_mod_php-6-2/php/.libs/libphp4.lax/libpcre.al
~/tmp/apache_mod_php-6-2/php/.libs/libphp4.lax/libposix.al
~/tmp/apache_mod_php-6-2/php/.libs/libphp4.lax/libsession.al
~/tmp/apache_mod_php-6-2/php/.libs/libphp4.lax/libstandard.al
~/tmp/apache_mod_php-6-2/php/.libs/libphp4.lax/libxml.al
~/tmp/apache_mod_php-6-2/php/.libs/libphp4.lax/libtsrm.al
~/tmp/apache_mod_php-6-2/php/.libs
Making all in pear
localhost:~/tmp/apache_mod_php-6-2/php$



So now it seems like I'm in the green -- it says that 'libtool will 
create a static module' for me.  But when I try to 'make install', I get 
an error.



localhost:~/tmp/apache_mod_php-6-2/php$ sudo make install
password:
... ( for sake of space, most 'make install' output omitted ) ...
Making install in .
/Users/eprice/tmp/apache_mod_php-6-2/php/build/shtool mkdir -p 
/usr/libexec/httpd  /usr/sbin/apxs -S 
LIBEXECDIR=/usr/libexec/httpd -i -a -n php4 libs/libphp4.so
[activating module `php4' in /etc/httpd/httpd.conf]
cp libs/libphp4.so /usr/libexec/httpd/libphp4.so
cp: libs/libphp4.so: No such file or directory
apxs:Break: Command failed with rc=1
make[1]: *** [install-sapi] Error 1
make: *** [install-recursive] Error 1
localhost:~/tmp/apache_mod_php-6-2/php$



There seems not to have been a 'libphp4.so' to copy into 
'/usr/libexec/httpd/libphp4.so'.  I posted to this list earlier, asking 
for advice on making this 'libphp4.so' file, but it seems no one knew 
the answer.  So, now I am wondering what 

the official name of 3.23.45 source

2001-11-26 Thread Erik Price

Hello all,

Can anyone tell me the official name of the MySQL 3.23.45 source code 
file that is downloaded from the web site (www.mysql.com)?

I normally grab it with curl off of my local mirror but they didn't have 
it yet so I used Internet Explorer to grab the file from another 
(random) mirror -- but the file is called download.php (which I assume 
is because the mirror dynamically served that page or something).

I have the source code and would like to make sure that it's named 
consistently, otherwise I'll end up with a bunch of download.php 
source code files in my source code directory over time.  The 3.23.44 
file was called mysql-3.23.44.tar.gz , but I don't want to make an 
assumption about the filename.

Thanks!


Erik


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: the official name of 3.23.45 source

2001-11-26 Thread Erik Price

Thanks!  I'll change the name from download.php to 
mysql-3.23.45.tar.gz in my source directory, and I'll remember the 
valuclick mirror.  I'm assuming that's in N. America somewhere.

Erik


On Monday, November 26, 2001, at 11:29  AM, Mike(mickalo)Blezien wrote:

 Try here:
 ftp://mysql.valueclick.com/pub/mysql/Downloads/MySQL-3.23/mysql-3.23.45.tar.
 gz

 I always find this FTP site with the most up-to-date files and is very 
 reliable!
 :)



 On Mon, 26 Nov 2001 10:17:22 -0500, Erik Price [EMAIL PROTECTED]   
 wrote:


 Can anyone tell me the official name of the MySQL 3.23.45 source 
 code
 file that is downloaded from the web site (www.mysql.com)?

 I normally grab it with curl off of my local mirror but they didn't 
 have
 it yet so I used Internet Explorer to grab the file from another
 (random) mirror -- but the file is called download.php (which I 
 assume
 is because the mirror dynamically served that page or something).

 I have the source code and would like to make sure that it's named
 consistently, otherwise I'll end up with a bunch of download.php
 source code files in my source code directory over time.  The 3.23.44
 file was called mysql-3.23.44.tar.gz , but I don't want to make an
 assumption about the filename.

 Mike(mickalo)Blezien
 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Thunder Rain Internet Publishing
 Providing Internet Solutions that work!
 http://www.thunder-rain.com
 Tel: 1(225)686-2002
 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: Mac OS X and MySQL 3.23.45

2001-11-26 Thread Erik Price

On Monday, November 26, 2001, at 11:34  AM, Michael Collins wrote:


 No, it is not found on Downloads for the 3.23 version at:

 http://www.mysql.com/downloads/mysql-3.23.html

 Look for:

 MacOS X downloads
 Binary packages (tar.gz)
 MySQL 3.23.45 MacOS X Server 1.x (PowerPC) (4.7M)
 MySQL 3.23.43 MacOS X 10.0.x (Darwin 1.3.x) (PowerPC) (4.6M)

Michael,

I just realized that the binary there is for Mac OS X Server, not 
client.  I'm sorry.  I didn't notice the difference at first.

 I suppose I could compile my own, but the binary is a lot more 
 convenient. I am just wondering if any special options were included. I 
 suppose then that it is the default.

You're right, it's a lot quicker.  I just compiled 3.23.45 with these 
options (following instructions from 
http://developer.apple.com/internet/macosx/osdb.html ):

localhost:mysql-3.23.45$ ./configure --prefix=/usr/local/mysql \
--with-unix-socket-path=/usr/local/mysql/run/mysql_socket \
--with-mysql-user=mysqladm \
--with-comment \
--with-debug

make

sudo make install

And that overwrote my old 3.23.44 source install (which had the same 
configure options) but preserved the data in my /usr/local/mysql/var 
directory.  Also, it looks like the owners and groups of the directories 
are also all intact (I think make install takes care of this by 
default).  The directory tree for the binary is a bit different (I tried 
it once) but this setup seems to work for me -- the bin/mysqladmin 
shutdown command works great now!!  (No more flush tables ; kill -9 
%1 or any of that!)

My thanks to the developers for taking into account the needs of Darwin 
users in their work -- we won't be a minority for long!

Erik


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




display size of integers

2001-11-26 Thread Erik Price

I have a rhetorical question.

I'm learning as much as I can about MySQL.  There is one little detail 
that I don't *have* to know the answer to, but I'm curious about.  Don't 
waste your time replying if you're busy.

It appears that the display width is an option for certain types of 
numeric columns.  For instance, SMALLINT(3) UNSIGNED which would be a 
number from 0 to 65535 with a display size of 3 characters in width, 
unless the value was greater than 3 characters in width, in which case 
all of the characters would be displayed.

What is the point of specifying a width?  I only see it being useful in 
combination with the ZEROFILL attribute, which would add leading zeros 
up to the display width if the number is fewer characters than the 
display width.  Otherwise, it seems to serve little purpose.

Would anyone mind shedding some light on this?

Thank you,
Erik


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




RE: does lmysqlclient.so exist in 3.23.44 ?

2001-11-24 Thread Erik Price

Hello Ravi,

Well, in the ./configure script, when I tried using just the
--with-mysql argument (without any argument like =/usr/local/mysql),
the configure script gave me this warning:

++
|*** WARNING *** |
||
| You chose to compile PHP with the built-in MySQL support.  If you  |
| are compiling a server module, and intend to use other server  |
| modules that also use MySQL (e.g, mod_auth_mysql, PHP 3.0, |
| mod_perl) you must NOT rely on PHP's built-in MySQL support, and   |
| instead build it with your local MySQL support files, by adding|
| --with-mysql=/path/to/mysql to your configure line.|
++

Because I do intend to eventually add mod_perl and possibly others, I
posted to this list (mysql) and asked for advice about what argument to
give to this configuration option, several respondents said you should
use --with-mysql=/usr/local/mysql.

Here is the link to this thread (from the archives):
http://lists.mysql.com/cgi-ez/ezmlm-cgi?1:mss:91900

Apparently the built-in MySQL support in PHP4 doesn't allow for other
DSO modules to work on that MySQL support (which makes sense).  You
mention that on OS X it could be more trouble than it's worth...
possibly, but I have everything up and running except for this one
thing -- I need to have the PHP4 DSO link to lmysqlclient.so file!  I
can get the PHP4 DSO up and running just fine without the
--with-mysql option, so I don't think that I'll have a problem once I
find that lmysqlclient.so file.

Thanks for your suggestions, though -- if I don't hear back about
lmysqlclient.so then I'll just have to do it with the built-in MySQL
support and worry about mod_perl later in the future.

Erik




--- Ravi Raman [EMAIL PROTECTED] wrote:
 Hi again.
 
 Why were you compiling php against the mysql source rather than using
 the
 built-in mysql support in php?
 From what I've read, it's probably more trouble than it's worth on
 OSX...
 
 -ravi.
 
 -Original Message-
 From: Erik Price [mailto:[EMAIL PROTECTED]]
 Sent: November 23, 2001 10:10 AM
 To: [EMAIL PROTECTED]
 Subject: does lmysqlclient.so exist in 3.23.44 ?
 
 
 Well, I asked a lengthy question earlier with all kinds of extraneous
 information pertaining to my problem.  Allow me to re-ask in a more
 simple fashion --
 
 does a file called 'lmysqlclient.so' exist in MySQL 3.23.44 ?  I
 built
 this distribution from source and cannot find it anywhere.  I need it
 for my PHP4  Apache DSO compile.
 
 Thank you,
 
 Erik

__
Do You Yahoo!?
Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.
http://geocities.yahoo.com/ps/info1

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




does lmysqlclient.so exist in 3.23.44 ?

2001-11-23 Thread Erik Price

Well, I asked a lengthy question earlier with all kinds of extraneous
information pertaining to my problem.  Allow me to re-ask in a more
simple fashion --

does a file called 'lmysqlclient.so' exist in MySQL 3.23.44 ?  I built
this distribution from source and cannot find it anywhere.  I need it
for my PHP4  Apache DSO compile.

Thank you,

Erik

__
Do You Yahoo!?
Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.
http://geocities.yahoo.com/ps/info1

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




RE: argument to --with-mysql option for PHP

2001-11-22 Thread Erik Price

Happy thanksgiving everyone!  And I especially thank those involved in
MySQL development and other open source projects -- you really make the
computer world a better place for all of us!

I also have a problem that I hope some can help me with ;-)

I wrote earlier in this thread, trying to compile PHP 4.0.6 as a DSO
for Apache with MySQL.  With helpful feedback from Ravi, I used
./configure with the following options:

--with-xml --with-zlib --with-mysql=/usr/local/mysql
--with-apxs=/usr/sbin/apxs

And it compiled -- but returned a warning.  I can't copy and paste the
warning because it's on my other machine, but I have transcribed it as
verbatim as I can:

=
WARNING:
This library needs some functionality provided by -lmysqlclient.  I
have the capability to make that library automatically link in when you
link to this library.  But I can only do this if you have a shared
version of the library, which you do not appear to have.
=

This warning was repeated, and then another warning:

=
WARNING:
libtool could not satisfy all declared inter-library dependencies of
module libphp4.  Therefore, libtool will create a static module, that
should work as long as the dlopening application is linked with the
-dlopen flag.
=

I searched all over my drive for lmysqlclient.so, but could only find
lmysqlclient.?a .  (I forget the exact letter, it was either
lmysqlclient.sa or lmysqlclient.la .)  This file was located in the
source tree from the build area where I first gnutarred mysql-3.23.44 .

I'm not very familiar with the workings of compilers, but I take it
that I am missing some library needed for PHP to operate as a DSO in
Apache, and that this library is lmysqlclient.so .  I'm surprised that
it isn't located in my source compile of MySQL.  Should I download this
file from somewhere else?

If I try to run 'make install' without linking this file first, I get
the following message at the end of the install:

. . . (install messages) . . .
cp libs/libphp4.so /usr/libexec/httpd/libphp4.so
cp: libs/libphp4.so: no such file or directory
apxs:Break: Command failed with rc=1
make[1]: *** [install-sapi] Error 1
make: *** [install-recursive] Error 1
Bash2.05$

Seems that libphp4.so did not get built during the 'make'.  And I
assume that this happened because the 'make' process could not find the
lmysqlclient.so .  Am I very far off the mark in this guess?

Thanks to any who can help with this quandary!

Sincerely,

Erik Price



--- Ravi Raman [EMAIL PROTECTED] wrote:
 
 You're right.
 ./configure --help for more information.
 
 
 -Original Message-
 If anyone can tell me which directory I should add, that would be
 great.  I assume that it is '--with-mysql=/usr/local/mysql' , but I
 wanted to make sure.


=
Microsoft e[X]tra [P]roprietary
-- Is this where you really wanted to go today ? --

http://www.redhat.com/about/opinions/xp.html

__
Do You Yahoo!?
Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.
http://geocities.yahoo.com/ps/info1

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




argument to --with-mysql option for PHP

2001-11-21 Thread Erik Price

Hello all,

I have a question that might be better suited to the PHP community, but
I thought that it was also relevant to the MySQL community (and I'm
already on this mailing list!!  :-)
I am compiling PHP 4.0.6 as a dynamic module (apxs) for Apache 1.3.22
on my Darwin 1.4.1 system (Mac OS X 10.1.1).  I am successfully running
a source install of MySQL 3.23.44 (installed in /usr/local/mysql). 
After downloading and decompressing the source code for PHP, I have
used the following options in ./configure:

./configure --with-xml --with-zlib --with-mysql
--with-apxs=/usr/sbin/apxs

I omitted the argument to '--with-mysql' because I was unsure of which
directory to assign to this option.  It seemed to configure just fine,
but then at the end it displayed this warning:

++
|*** WARNING *** |
||
| You chose to compile PHP with the built-in MySQL support.  If you  |
| are compiling a server module, and intend to use other server  |
| modules that also use MySQL (e.g, mod_auth_mysql, PHP 3.0, |
| mod_perl) you must NOT rely on PHP's built-in MySQL support, and   |
| instead build it with your local MySQL support files, by adding|
| --with-mysql=/path/to/mysql to your configure line.|
++

as I would like to later see about installing mod_perl or other DSOs
for Apache, I didn't want to use the built-in MySQL support.  But I'm
not sure what path to specify to the '--with-mysql' option.  Here is a
list of my /usr/local/mysql directory:

localhost:~/Downloaded/builds/build-php-4.0.6/apache_mod_php-6-2/php$
ls -lF /usr/local/mysql
total 0
drwxr-xr-x  36 root  mysqlgrp  1180 Nov 16 18:45 bin/
drwxr-xr-x   3 root  mysqlgrp   264 Nov 16 18:44 include/
drwxr-xr-x   3 root  mysqlgrp   264 Nov 16 18:44 info/
drwxr-xr-x   3 root  mysqlgrp   264 Nov 16 18:44 lib/
drwxr-xr-x   3 root  mysqlgrp58 Nov 16 18:45 libexec/
drwxr-xr-x   3 root  mysqlgrp   264 Nov 16 18:45 man/
drwxr-xr-x   9 root  mysqlgrp   264 Nov 16 18:45 mysql-test/
drwxr-xr-x   8 mysqladm  mysqlgrp   264 Nov 21 09:56 mysqladm/
drwxr-xr-x   4 mysqladm  mysqlgrp   264 Nov 21 09:59 run/
drwxr-xr-x   3 root  mysqlgrp58 Nov 16 18:45 share/
drwxr-xr-x  23 root  mysqlgrp   738 Nov 16 18:45 sql-bench/

drwx--   7 mysqladm  mysqlgrp   264 Nov 21 09:59 var/






If anyone can tell me which directory I should add, that would be
great.  I assume that it is '--with-mysql=/usr/local/mysql' , but I
wanted to make sure.

Thank you,

Erik Price

PS:  Just to re-clarify about my system, it is:
Darwin 1.4.1 running beneath Mac OS X 10.1.1
Apache 1.3.22 with DSO capability enabled
MySQL 3.23.44 (source install) installed in /usr/local/mysql 

=
Microsoft e[X]tra [P]roprietary
-- Is this where you really wanted to go today ? --

http://www.redhat.com/about/opinions/xp.html

__
Do You Yahoo!?
Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.
http://geocities.yahoo.com/ps/info1

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: Nusphere is spamming me (this is cheese)

2001-11-20 Thread Erik Price

It looks like this site is designed to fool a newcomer into thinking
that they've stumbled onto the MySQL site -- there is a tiny mention on
the splash page that 'if you are looking for MySQL AB, click here'. I'm
sorry, but when I was first looking into MySQL, I had no idea what
'MySQL AB' was.  I would probably have assumed that it was some kind of
open-source claim-jumper.

Oh wait, that's what NuSphere is.

At any rate, becoming a member of NuSphere looks like a great way to
get your email address harvested.  Apart from that, the site doesn't
offer anything that you can't get at www.mysql.com (and you can get a
lot more at the latter).

Nothing technically illegitimate, but shifty nonetheless.
-- Erik


--- Andy Woolley [EMAIL PROTECTED] wrote:
 For a long time now Nusphere has been treading on far too many
 peoples toes
 (who do they think they are) not only are they annoying MySQL users
 with
 their exasperating antics they are also trying to steal MySQL from
 the very
 people that actually wrote the software.
 
 Dont forget,they have registered http://www.mysql.org for some very
 bizzare
 reasons.


=
Microsoft e[X]tra [P]roprietary
-- Is this where you really wanted to go today ? --

http://www.redhat.com/about/opinions/xp.html

__
Do You Yahoo!?
Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.
http://geocities.yahoo.com/ps/info1

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php





List Info

2001-11-18 Thread Erik Price

Bill,

Actually, there *is* a digest -- send mail to

[EMAIL PROTECTED]

the information about this and all other listserver commands is in the
welcome message that you should have received as your first
mysql@lists email.  I have been using the digest.

BUT...  All of Bernie's comments are right on -- the digest has
actually been a pain to use for every reason he describes.  I'm going
to use his suggestion of setting up a filter to keep MySQL stuff in its
own folder (and easy to wipe out if it gets to be too much to read). 
Still, web-based mail services are a pain (generating a new web page
for every email I get is kind of slow) -- I look forward to getting a
proper email address sometime soon.


Erik

=
Microsoft e[X]tra [P]roprietary
-- Is this where you really wanted to go today ? --

http://www.redhat.com/about/opinions/xp.html

__
Do You Yahoo!?
Find the one for you at Yahoo! Personals
http://personals.yahoo.com

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: Dumb Question: Listing tables in telnet

2001-11-18 Thread Erik Price

Todd,

The arrow is like the PS2 prompt from your shell in Unix.  That is,
the first line of your command says

Mysql

and every line thereafter is just a greater-than.  This is because
the mysql client is waiting for more commands.  You can enter more than
one command at a time this way, and not have to write it all out on one
line.

When you are finished with a command, place a semi-colon or a
backslash-g.  In other words, I think you wanted to enter the
following command:

Mysql show tables ;

or

Mysql show tables \g

Note that the spacing between the command and the semi-colon (or \g)
doesn't matter, you can have the sem come right after your text or you
can add a space for clarity.

--- Todd Williamsen [EMAIL PROTECTED] wrote:
 I looked all through the documentation for this and I cannot find the
 command for listing tables in mysql in telnet.
 
 I get this:
 Mysql show tables
 -
 
 I have no idea what the arrow does and what I am suppose to do with
 it.
 I type in commands and it just does another -  What is that?
 
 Thank you,
  
 Todd Williamsen, MCSE
 home: 847.265.4692
 Cell: 847.867.9427


=
Microsoft e[X]tra [P]roprietary
-- Is this where you really wanted to go today ? --

http://www.redhat.com/about/opinions/xp.html

__
Do You Yahoo!?
Find the one for you at Yahoo! Personals
http://personals.yahoo.com

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: shutdown still a problem on Darwin

2001-11-16 Thread Erik Price

Sinisa, everyone,

That's great news!  I'm excited to hear that.  Which version would that
be... 4.0?  Or perhaps another 3.x version?

In the meantime, my boss is going to wonder why I'm not populating a
database for him.  He will make me use Access if I don't get cracking,
so... do you know of a working version of MySQL for Darwin 1.4.1 ?

Alternatively, I am open to a workaround until the working version is
released.  I can actually use MySQL (as far as I know), it's just the
shutdown that hangs.  I have to use kill -9 in order to kill the
daemon.  This makes me worry about my data, since this command has the
potential to cause corruption.  Is there some way that I can preserve
the data, or protect it from corruption, so that at the end of the day
when I shut down my laptop I can use kill -9 without fear of damaging
the contents?

Or is the best policy to just back up the data directory and then go
ahead and kill the daemon, then in the morning when I get to work move
the backup back into the working directory?

I admit that I'm still new to MySQL so I'm not sure exactly what the
best course of action would be.

Thanks to Sinisa, Sasha and to anyone who has input on this situation,


Erik

PS: do you advise that I beta-test the upcoming MySQL version?  I would
be open to this idea, especially if it fixes my problem, but I am
working in a production environment and so would be best served with as
stable a release as is available.

--- Sinisa Milivojevic [EMAIL PROTECTED] wrote:
 Erik Price writes:
  Hello all,
  
  Some of you may recognize this post somewhat, I've asked about this
  problem before:
  
  I am unable to execute the shutdown command with mysqladmin,
 running
  on Darwin 1.4.1 (from Mac OS X 10.1.0).
 
 Hi!
 
 Our colleague Sasha Pachev has made some changes in the signal
 handling part of our server that should  solve your problems.
 
 Those fixes should come up in the next MySQL version. 
 
 -- 
 Regards,
__  ___ ___   __
   /  |/  /_ __/ __/ __ \/ /Mr. Sinisa Milivojevic
 [EMAIL PROTECTED]
  / /|_/ / // /\ \/ /_/ / /__   MySQL AB, Fulltime Developer
 /_/  /_/\_, /___/\___\_\___/   Larnaca, Cyprus
___/   www.mysql.com
 


=
Microsoft e[X]tra [P]roprietary
-- Is this where you really wanted to go today ? --

http://www.redhat.com/about/opinions/xp.html

__
Do You Yahoo!?
Find the one for you at Yahoo! Personals
http://personals.yahoo.com

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




I think I have a solution! (was: mysqld shutdown)

2001-11-16 Thread Erik Price


Hello all,

As I have written about in two earlier threads this week (you can read
them in the mysql.com archives at these URLs:

http://lists.mysql.com/cgi-ez/ezmlm-cgi?1:sss:91326#b
and
http://lists.mysql.com/cgi-ez/ezmlm-cgi?1:sss:91495#b

), I am unable to execute the shutdown command in mysqladmin.  This
is a problem, as I am building my database on a Macintosh laptop
running Darwin 1.4.1 / OS X 10.1.0 , and need to shut my computer down
fairly frequently -- usually at least once per day.  Later, I intend to
migrate the database to a HP/UX server, but until I get the ball
rolling I must work locally on my computer.

Sinisa Milivojevic has mentioned that a fix for this problem is
scheduled for the next MySQL release.  I'll gladly upgrade when it is
available, but in the meantime I need to work on this project for my
employer, and can't wait until then to get started.  Also, it sounds
geeky to say this but it's difficult to contain the excitement of
learning about MySQL and PHP, especially now that I have a job that
pays me to do so.  Until the next release is available, I must use the
dreaded kill -9 shell command to shut down the MySQL daemon, which
may corrupt data in the database.  So I am wondering if anyone can shed
some light on this workaround that I am considering:

I have been reading about mysqldump in Paul DuBois's excellent book,
MySQL (New Riders, c 2000).  It seems that I can use mysqldump to
save my database data to a file before I execute the kill -9 shell
command to shut down mysqld.  In the book, DuBois calls this
refreshing the database, and writes (pp. 435-6) that using

bash2.05$ mysqldump --add-drop-table samp_db  /path/to/backup/file

would be the correct way to do this.  This is because, apparently, a
database will give an error if I try to reload the backup file into it,
because the tables already exist.

This raises another question -- will the original database accept this
backup if it *has* been corrupted?  Or will I have to run isamchk or
myisamchk first, every time I wish to re-load (refresh) the
information?  I understand that my database probably won't become
corrupted every single time from a kill -9 command, but it is likely
to happen at some point as I will be doing this daily.

Does anyone think that this is a viable solution to my problem?  Thanks
very much for any input or thoughts!


-- Erik Price

PS: To all who respond, please CC me directly, as I am a digester and
will have to wait for the next digest to read your response.  Thank
you.

PPS: One final question, of which I think I already know the answer but
request confirmation: if I do some database development with my binary
install of mysql-3.23.43-apple-darwin1.3.7-powerpc (currently on my
hard drive), will I be able to dump the data to a file, remove the
MySQL installation entirely, compile mysql-3.23.44.tar.gz with a few
extra ./configure options, and re-load the data from the backup?  It
seems like this wouldn't be a problem, because the only thing I am
saving is backup information.  I would just have to make sure to create
a new database into which I can load the backup information.

__
Do You Yahoo!?
Find the one for you at Yahoo! Personals
http://personals.yahoo.com

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: shutdown still a problem on Darwin

2001-11-16 Thread Erik Price

--- Dan Nelson [EMAIL PROTECTED] wrote:
 As long as there are no active connections, killing mysql will not
 affect the database.  If you kill mysql during an update, you risk
 corrupting any indexes on the tables being modified.  If your tables
 are BDB or InnoDB format, you should be able to kill mysql at any
 time
 without damaging your tables.

What about the mysql database itself -- the grant tables?  I'm the only
user right now (and my partner will join a bit later on), but I my
project won't go public until it gets onto a more stable server, so
I'm not worried about any connections being open, but won't the grant
tables be accessed when I execute mysqladmin shutdown?  Oh... right,
I'm not executing that.  Alright, that's good news!  Thanks!


Erik

__
Do You Yahoo!?
Find the one for you at Yahoo! Personals
http://personals.yahoo.com

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: HELP - Setting up MySQL on Mac OS X 10.0.4

2001-11-14 Thread Erik Price


 Has anyone successfully set up MySQL on Mac OS X 10.0.4 yet?  If so, 
 what distribution did you use?  What special steps (if any) did you 
 have to take?  Every tutorial on this topic that I've found on the 
 web so far, is either outdated or has simply has not worked for me.


That's because Mac OS X 10.0.4 is outdated.  Unless you have a really
good reason not to use it, you should use 10.1 (it's much much better
for only a $20 upgrade).  Note that 10.1 DevTools is different from
10.0.4, so you will need that too (free download with registration @
apple.com), and there will be some changes especially if you use
Apache.

If you need more info on that, email me, but on the subject of setting
up MySQL on 10.1:

http://developer.apple.com/internet/macosx/osdb.html
http://www.stepwise.com/Articles/Workbench/2001-10-11.01.html

and if you want to do a binary install, there's Fink or Marc Liyanage's
packages:

http://fink.sourceforge.net
http://www.entropy.ch/software/MacOSx/mysql/

Fink is well worth it, it is a port of Debian's package management for
Darwin (and there are plenty of ports available through Fink).

Erik



=
Microsoft e[X]tra [P]roprietary
-- Is this where you really wanted to go today ? --

http://www.redhat.com/about/opinions/xp.html

__
Do You Yahoo!?
Find the one for you at Yahoo! Personals
http://personals.yahoo.com

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: Need A book for dynamic website

2001-11-14 Thread Erik Price

When I was just starting to consider my database-driven web site, I
checked mysql.com and found this:

http://www.mysql.com/portal/books/html/index.html

The best-rated book is the one I chose to get:

MySQL
by Paul DuBois
New Riders

I think it's awesome.

(Although neither it nor the web site documentation can help me with my
problem in shutting down the mysql daemon with mysqladmin..  !)

I originally had purchased

MySQL/PHP Database ApplicationsĀ  
by Jay Greenspan and Brad (forget last name)

And found its example code was ridden with typos and errors, to the
point that I was having a great deal of trouble following the text.  I
took it back to the store to get the DuBois book.


Erik


--- Webmaster [EMAIL PROTECTED] wrote:
 
 Hi,
 I need a book to teach me how to make a database driven website, I
 think php
 mySql is the way to go and have seen some on amazon and fat brain but
 don't
 know if any are any good, any ideas?
 
 Thanx in advance
 DavidJaymz
 Here are the books I'm thinking of:
 PHP and MySQL Web Development
 Luke Welling, Laura Thomson
 
 Database Driven Web Sites
 By Joline Morrison,Joline Morrison
 
 Sams Teach Yourself Active Web Database Programming in 21 Days
 By Dina Fleet,Matt Warren (Editor)
 
 Building Database Applications on the Web Using Php3
 By Craig Hilton,Bjorn Borud,Jeff Willis
 
 Create Dynamic Webpages Using PHP and MySQL
 David Tansley
 
 PHP: Fast and Easy Web Development
 J. Meloni
 
 Thanx again: DavidJaymz
 
 
 -
 Before posting, please check:
http://www.mysql.com/manual.php   (the manual)
http://lists.mysql.com/   (the list archive)
 
 To request this thread, e-mail [EMAIL PROTECTED]
 To unsubscribe, e-mail
 [EMAIL PROTECTED]
 Trouble unsubscribing? Try:
 http://lists.mysql.com/php/unsubscribe.php
 


=
Microsoft e[X]tra [P]roprietary
-- Is this where you really wanted to go today ? --

http://www.redhat.com/about/opinions/xp.html

__
Do You Yahoo!?
Find the one for you at Yahoo! Personals
http://personals.yahoo.com

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: mysqld shutdown

2001-11-14 Thread Erik Price

--- Bill Adams [EMAIL PROTECTED] wrote:
   One option is to use
 
  /usr/local/mysql/bin:mysql$ mysqladmin -u root -p shutdown
 
  But this one doesn't work for me, even though I am using the proper
  password and am the proper user.  Executing this command just
 leaves me
  hanging at the prompt (and the only way to get out of the hang is
 to
  either suspend the job, which also has no effect).
 
 Do you have a query still running? E.g. does mysqladmin -uroot -p
 processlist show any locks?  If so, can you kill the thread with
 mysqladmin
 kill?

Bill,

First of all, thanks for responding -- I'm a bit worried about this
problem (since I can't come across a logical solution yet).  Being new
to MySQL, I hadn't checked for running processes, but I just tried your
command:

mysql:localhost~:$ ../bin/mysqladmin -u root -p processlist
Enter password: 
++--+---++-+--+---+--+
| Id | User | Host  | db | Command | Time | State | Info   
 |
++--+---++-+--+---+--+
| 4  | root | localhost || Query   | 0|   | show
processlist |
++--+---++-+--+---+--+
mysql:localhost~:$ 

I'm assuming that this says that the only query is the actual
processlist command itself, so it doesn't need to be killed.  Any
other ideas?

Erik

PS:  If I run the mysqladmin shutdown command, then check top in
another console, both the daemon and the mysqladmin command continue to
run indefinitely -- and I have waited an hour to see if it's just slow.
 That doesn't seem to be the case.

__
Do You Yahoo!?
Find the one for you at Yahoo! Personals
http://personals.yahoo.com

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: mysqld shutdown

2001-11-14 Thread Erik Price

--- Bill Adams [EMAIL PROTECTED] wrote:
 This seems like an OS bug to me.  All of the things you mention in
 your last
 email should stop mysql from running.
 
 What happens if you do (where safe_mysqld is running) 'fg' and
 then CTRL+c?  Does that just hang too?
 
 Do you need the debugging for mysql? (it slows it down).  Perhaps
 there is a
 problem with that and recompiling w/o --with-debug would help.

Here's what I get:

mysql:localhost~:$ jobs
[1]+  Running /usr/local/mysql/bin/safe_mysqld
--socket=/usr/local/mysql/run/mysql_socket 
mysql:localhost~:$ fg
/usr/local/mysql/bin/safe_mysqld
--socket=/usr/local/mysql/run/mysql_socket  (wd: /Users/eprice)
^C
^C
^\
^\
^Z
^Z

(still hanging/waiting)



So... I used --with-debug because the instructions that I was following
included them and because I thought that it might be useful to have. 
Do you think that it's something I can live without?  I don't even know
how to use the debug, to be completely honest.

If I do need to recompile without --with-debg, what's the procedure for
that?  Do I need to remove the /usr/local/mysql directory, and start
over from ./configure ?  I'm new to compiling from source, so I don't
know what the standard procedure is.

Thanks,


Erik



__
Do You Yahoo!?
Find the one for you at Yahoo! Personals
http://personals.yahoo.com

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: mysqld shutdown

2001-11-14 Thread Erik Price

--- Mike(mickalo)Blezien [EMAIL PROTECTED] wrote:
 Have you tried ./mysqladmin -u root -p shutdown
 
 when in the 'bin' folder otherwise typing mysqladmin, it will check
 the server
 PATH, to find the mysqladmin
 
 
 Mike(mickalo)Blezien

Hmm... isn't this the same thing as /usr/local/mysql/bin/mysqladmin -u
root -p shutdown  ?

Either way, I tried it... cd to /usr/local/mysql/bin and then
./mysqladmin -u root -p shutdown... same effect.

Note that on my system, safe_mysqld is located in /usr/local/mysql/bin
, not in the standard /bin directory.


Thanks,

Erik

__
Do You Yahoo!?
Find the one for you at Yahoo! Personals
http://personals.yahoo.com

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: mysqld shutdown

2001-11-14 Thread Erik Price

--- Sergei Golubchik [EMAIL PROTECTED] wrote:

 What OS do you use ?
 
 The behaviour you're describing I've seen two-three years ago on
 FreeBSD
 due to some bug/deficiency in FreeBSD threads.
 Since then it was fixed (in FreeBSD I mean).
 
 Regards,
 Sergei


Interesting!  I'm using Darwin 1.3.1 (from Mac OS X 10.1.0), which was
partly derived from one of the BSDs (I think it was FreeBSD in fact). 
What was the fix that was used?  Maybe I can get it to apply to this
situation.


-- Erik

__
Do You Yahoo!?
Find the one for you at Yahoo! Personals
http://personals.yahoo.com

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: mysqld shutdown

2001-11-14 Thread Erik Price

Dan,

Thanks for that comprehensive answer.  It doesn't seem like the FreeBSD
solution will be one that I will try to implement into my installation
of Darwin, as it draws on skills and knowledge that I definitely don't
have -- though it would be educational to take a look into Darwin's
threading system (and see if it matches that of FreeBSD), I wouldn't
know where to start.

After a re-compile with different options but identical problems, I
have decided that when I get to work tomorrow I'll try one of the
binaries from my local MySQL mirror, unless someone can suggest
Darwin-friendly ./configure options.

Interesting that the first (50-line commit) patch to FreeBSD's libc_r
was almost three years ago to the day!


Erik


--- Dan Nelson [EMAIL PROTECTED] wrote:
 In Mysql 3.22.11, the signal was changed to SIGTERM and a signal
 handler was explicitly installed.  As far as libc_r patches, there
 are
 two candidates.  One is a 50-line commit on 1998-11-15 with the
 comment
 Interrupt threads waiting in select etc..  There was another large
 (2000-line) commit on 1999-07-23 with the comment MFC: Bring in both
 bug fixes, performance improvements, and enhancements.  This should
 fix
 MySQL problems.  The commit went in between the releases of FreeBSD
 3.2 and 3.3.  I don't know exactly what version of code Apple used
 for
 Darwin, or how easy it would be to merge those changes into Darwin's
 libc_r if they're not already in there.  Darwin might not even be
 using
 FreeBSD's thread library.
 
 -- 
   Dan Nelson
   [EMAIL PROTECTED]


=
Microsoft e[X]tra [P]roprietary
-- Is this where you really wanted to go today ? --

http://www.redhat.com/about/opinions/xp.html

__
Do You Yahoo!?
Find the one for you at Yahoo! Personals
http://personals.yahoo.com

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




mysqld shutdown

2001-11-13 Thread Erik Price

All,

Well, I solved the mystery of the missing Unix socket.  It needs to be
defined at the time the daemon is started with: 
--socket=/path/to/socket.   Well, at least in my installation it does.

But now I'm having the OPPOSITE problem -- shutting down the server
(the daemon).  I've searched the issue at length in the documentation,
as well as in DuBois' MySQL (New Riders), and found quite a bit of
information about shutting down the server.  One option is to use

/usr/local/mysql/bin:mysql$ mysqladmin -u root -p shutdown

But this one doesn't work for me, even though I am using the proper
password and am the proper user.  Executing this command just leaves me
hanging at the prompt (and the only way to get out of the hang is to
either suspend the job, which also has no effect).

Here's another option -- killing the process.  This doesn't work
either, surprisingly.

/usr/local/mysql/bin:mysql$ jobs
[1]+  Running /usr/local/mysql/bin/safe_mysqld
--socket=/usr/local/mysql/run/mysql_socket 

/usr/local/mysql/bin:mysql$ kill %1
/usr/local/mysql/bin:mysql$ jobs
[1]+  Running /usr/local/mysql/bin/safe_mysqld
--socket=/usr/local/mysql/run/mysql_socket 

See?  Still running.  And I've tried killing it using the PID, and that
has no effect either.

The only thing that DOES work, is

/usr/local/mysql/bin:mysql$ kill -9 17344 (where 17344 = PID)

But I don't want to do this, because the documentation and the book
suggest that using kill -9 doesn't give the tables a chance to
properly shut down.

I would like to be able to shut down the daemon whenever I wish, and I
have not yet configured the daemon to shut down automatically at system
shutdown (or start up at system startup).  I do intend to eventually do
this, and later, when I migrate the database off of my laptop and onto
a proper server, this won't be an issue, but for right now it is.  I
don't want to have to run isamchk or myisamchk all the time and always
restore damaged tables from backups, either.

Please help me nip this problem in the bud, before I go about
populating my database with information.  I compiled MySQL from source,
version 3.22.44 onto Darwin 1.3.1 using the following configure
parameters:

--prefix=/usr/local/mysql --with-comment --with-debug
--with-mysql-user=mysql
--with-unix-socket-path=/usr/local/mysql/run/mysql_socket

Although I confess I am very new to MySQL and am not sure how to use
the debug yet.


Thanks for anyone who can help!!!



-- Erik

=
Microsoft e[X]tra [P]roprietary
-- Is this where you really wanted to go today ? --

http://www.redhat.com/about/opinions/xp.html

__
Do You Yahoo!?
Find the one for you at Yahoo! Personals
http://personals.yahoo.com

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: failer to start the mysql server

2001-11-13 Thread Erik Price

I had this same error message yesterday when I first set up MySQL.

Two possible reasons:

1) Is mysqld running?  I used

bash2.05$ ps aux | grep mysqld

to see if there is a process called mysqld.

2) In my installation (which I compiled from source, with the Unix
socket path option in configure)

bash2.05$ pwd
/usr/home/eprice/build-mysql-3.23.44/
bash2.05$ ./configure
--with-unix-socket-path=/usr/local/mysql/run/mysql-socket

This sets the location of the Unix socket to
/usr/local/mysql/run/mysql-socket .
So when you start MySQL daemon, you must specify the socket path:

/usr/local/mysql/bin/safe_mysqld
--socket=/usr/local/mysql/run/mysql-socket 


If you installed MySQL from a binary package/RPM, I am not sure where
the socket is located by default.  Check the package documentation. 
The MySQL documentation (www.mysql.com) suggests that you may have
cron set to clean up files in /tmp .  If this is true, then cron
may have removed your Unix socket file.  You must restart the MySQL
daemon and change cron (or change the socket location).

I am very new to MySQL but I have had this same experience so I thought
I would share my own discovery.

check this page:
http://www.mysql.com/doc/C/a/Can_not_connect_to_server.html


Erik


--- R.Neubert [EMAIL PROTECTED] wrote:
 and this is wrong:
 
 [root@linux mysql]# mysqladmin reload
 mysqladmin: connect to server at 'localhost' failed
 error: 'Can't connect to local MySQL server through socket
 '/var/lib/mysql/mysql.sock' (2)'
 Check that mysqld is running and that the socket:
 '/var/lib/mysql/mysql.sock' exists!


=
Microsoft e[X]tra [P]roprietary
-- Is this where you really wanted to go today ? --

http://www.redhat.com/about/opinions/xp.html

__
Do You Yahoo!?
Find the one for you at Yahoo! Personals
http://personals.yahoo.com

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




creating a Unix socket

2001-11-12 Thread Erik Price

Hello,

Despite hours plumbing the MySQL documentation and Paul DuBois' book
MySQL (New Riders), I can't figure out what exactly creates the Unix
socket for local connections.  For some reason no socket was created
during my setup, and I'm not sure how to go about making one.

I compiled 3.23.44 from source on Darwin 1.4.1, using these options:

Bash 2.05 $ ./configure --prefix=/usr/local/mysql
--with-unix-socket-path=/usr/local/mysql/run/mysql_socket
--with-mysqld-user=mysql --with-comment --with-debug

I am able to run ' /usr/local/mysql/bin/safe_mysqld --with-user=mysql 
'  with no problem.  However, I cannot get any of the client programs
to communicate with the MySQL server.  I believe that my Unix socket
(for local connections) is not set up properly, since mysqld runs fine.

I believe that I made a mistake in not having a /usr/local/mysql/run
directory set up at setup time.  Instead, I created the run directory
after running mysql_install_db but before running safe_mysqld.  for
some reason I assumed that the socket would be created dynamically when
I started the mysql daemon.

Is there a script or program that I can use to create the socket?  Any
advice would be greatly appreciated, I'd like to avoid recompiling the
whole distribution if possible.  (If that is not possible, is it simply
a matter of not having the /usr/local/mysql/run directory set up at
compile time?)


Thank you,

Erik

=
-- Is this where you really wanted to go today ? --

http://www.redhat.com/about/opinions/xp.html

__
Do You Yahoo!?
Find a job, post your resume.
http://careers.yahoo.com

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: creating a Unix socket

2001-11-12 Thread Erik Price

I've been a fool.  I didn't realize that I had to use the following
option when starting up the mysql daemon:

--socket=/usr/local/mysql/run/mysql_socket

I suppose that my instructions might have left this out.  Normally the
socket is created in /tmp (absolute pathname) right?  But when I
specified --with-unix-socket-path=/usr/local/mysql/run/mysql_socket in
the ./configure , I assumed that this would automatically set the
socket to occur in /usr/local/mysql/run without any further work on my
part.

So does that mean that forevermore when invoking the daemon I need to
use the socket option?

-- Erik

PS: the documentation at mysql.com is incredible.


--- Bill Adams [EMAIL PROTECTED] wrote:
 Erik Price wrote:
 for
  some reason I assumed that the socket would be created dynamically
 when
  I started the mysql daemon.
 
 It does.
 
 Try chown mysql:mysql /usr/local/mysql/run
 
 Then restart mysqld.
 
 b.
 


=
-- Is this where you really wanted to go today ? --

http://www.redhat.com/about/opinions/xp.html

__
Do You Yahoo!?
Find a job, post your resume.
http://careers.yahoo.com

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php