Problem with complex query
Hi, i'm trying to make a simple message board and I need a bit of help to finish up. Here's my database structure first with some example data: TABLE: mboard mid | topic | name| date 1 New site John Doe 2 Re: New site Susie Q TABLE: mboardindex mbiid | mid | message 1 1 1 2 1 2 mboard holds all the data and mboardindex holds what messages go with what. In this case, mid = message = 1 indicates original message. mid =1, message = 2 indicates reply to message 1. Now, my problem is, i'm doing this in PHP4 and without subselects, i'm not sure how to get the data to list like: New siteJohn Doe Re: New siteSusie Q Here's my query: SELECT * FROM mboard,mboardindex WHERE mboard.mid = mboardindex.mid ORDER BY date Well, this gets me everything with mboard.mid = mboardindex.mid = 1 (in the case above). Well, how do I get it mysql to select from the result of the above SELECT statement. For example, I want to select the mboardindex.message from the above select statement results. Normally, I would use a sub-select but we can't do that in mysql. Can anyone help me out? Thanks, Mike - 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
max. value from select statement
I have a table as such where mid is my auto increment primary key: TABLE: mboard mid 2 3 4 5 I'm doing this in combination with PHP4. What I want to do is build a query that will allow me to get the largest mid from the table (mboard) above. The query I have is: select max(mid) from mboard; BUT I tried the following in PHP and it doesn't work: $myquery = SELECT max(mid) FROM mboard; $myresult = mysql_query($myquery); $row = mysql_fetch_object($myresult); print $row-mid is result; Any ideas on how to do this? Mike _ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp - 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
ERROR rotating logs problem in MySQL(Linux)
I'm pretty new to the Linux world and i'm getting the following error: errors occured while rotating /var/log/mysqld.log mysqladmin: connect to server at 'localhost' failed error: 'Access denied for user: 'root@localhost' erorr running prerotate script -- leaving old in place Does anyone know how I can fix this on my Linux Red Hat 7 Server? Thanks, Mike - 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
Query help
I'm trying to build a query for a calendar program for a web site. Basically, I want a query that will print a word if there is an event booked on that day. Here's how the relevant tables are laid out and what they mean: TABLE: activities AID - Primary Key ALocation AEmail AName ADay AMonth AYear ACost ATime TABLE: clientactivities CAID - Primary key CUserName AID - Foreign key from activities Basically, activities lists all the activities announced by members. Client activities shows all the events that a person has signed up for. How can I build a query that will accommodate both tables. Currently, i've got: SELECT * FROM activities WHERE (activities.CUserName='$CUserName' AND ADay='$d' AND AMonth='$themonth' AND AYear='$y') OR activities.AID = clientactivity.AID) But it doesn't quite work. Thanks, Mike _ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.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
external access to mysql
I and 2 others are working on a web site an occasionally. Each of us are in different locations and exchange info email. Some of them need to query the database to compare results with what is on the site with the MySQL database. My question is, is there a way to allow access to my database by creating an account for each user and allowing them to connect to the database externally? Thanks, Mike - 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
Exporting data
How do I dump all the contents of a table called "clients" into a .txt file (or anyother kind of file for that matter). Thanks for your help. Mike - 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 and MySQL combo
Is there anyway to tell how many connections are currently being served by MySQL. I'm using this in combination with PHP. Also, does MySQL automatically shut down when you leave the page? I'm not using mysql_pconnect - just the regular mysql_connect. Thanks, Mike - 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
Problem with creating default value
Hi. This is a really easy question: I have an existing table called clients. I have an existing field called CPicture. I'm trying to add a default value of "no". I've tried several times and can't seem to get it right. So, does anyone know how I can add a default value of "no" to an existing table (clients) and field (CPicture)? Thanks for your help. Mike - 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