adding an incremented count from page hits
I have an existing database/tables and would like to add a counter to a table that would increment when a document is downloaded from the database. I am sure it is an easy addition to the php page but struck-out looking for info not related to auto-increment in the mysql manual. I tried adding this to the php page: (more else statements up here) elseif ($orderby == 'bg'): $sql = select * from manuals_list where cat like 'bg' order by 'file_name'; else: $sql = select * from manuals_list where cat like 'ap' order by 'file_name'; endif; $result = mysql_query($sql); while ( $row = mysql_fetch_array($result)) { printf(tr\ntd class=\link\\n a href='../docs/$row[url]'%s/a\n/td\ntd%sKB/td\ntd%s/td\n/tr\n, $row[file_name], $row[size], $row[rev]); } count=count+1; --- This is the added bit --- ? --- The count doesn't increment in the database. The table has a column called 'count'. Can someone please please point me in the right direction? Thanks, Chip -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
stop and restart mysql on freebsd?
I made a change to my.cnf and want it to restart mysqld_safe so it will re-read my.cnf. How do I do this? Thanks, Chip -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
copy data only from one table to another table
How do I copy all data only from one table into another table? Both tables are in the same database. I have phpMyAdmin and it suppossedly does this, but it is not working, and there are no error messages. Thanks, -- Chip -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
query of two tables returns far too many rows, more than the two tables contain
I have two tables I want to get out the rows that are different between them. The results I am getting is almost 50,000 rows, but the two tables, combined, contain only about 600 rows total. Here is the select statement - SELECT dealers.account_no, dealers.DealerName, blackgate_users.User_Name, blackgate_users.DealerName FROM dealers, blackgate_users WHERE dealers.account_no NOT LIKE blackgate_users.User_Name in these tables the dealers.account_no is the same data as the blackgate_users.User_Name dealers.DealerName is the same data as the blackgate_users.DealerName I just want the rows that are in the dealers table but not in the blackgate_users table. Thanks for any help, Chip Wiegand Computer Services Simrad, Inc 425-778-8821 425-771-7211 (FAX) -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: query of two tables returns far too many rows, more than the two tables contain
[EMAIL PROTECTED] wrote on 11/11/2004 02:05:17 PM: snip What you want to do is to write a query that lists every record from the dealers table OPTIONALLY matched up to rows on the blackgate_users table wherever the names match. This is what the LEFT JOIN operator was invented to do (you were using an INNER JOIN). Now, to find the non-matches you look for rows from the blackgate_users table where a normally non-null value IS NULL. Because you want ALL of the rows from the dealers table but only some of the rows from the blackgate_users table (you declare that when you say LEFT JOIN), the query engine fills in the missing rows from the right hand table (in this case blackgate_users) with all NULL values. SELECT dealers.account_no, dealers.DealerName, blackgate_users.User_Name, blackgate_users.DealerName FROM dealers LEFT JOIN blackgate_users ON dealers.account_no = blackgate_users.User_Name WHERE blackgate_users.account_no IS NULL Thanks for the help. That gets me much closer. I did a count in both tables and figured there should be 121 rows returned by the query. The above select statement gets me 141 rows returned. With a little sleuthing around in there I will probably figure out what the extra 10 rows are. Thanks you very much. Regards, Chip So by looking for only those rows where the right hand table contains NULL values, you find the non-matching rows. Get it? Shawn Green Database Administrator Unimin Corporation - Spruce Pine Chip Wiegand [EMAIL PROTECTED] wrote on 11/11/2004 04:29:08 PM: I have two tables I want to get out the rows that are different between them. The results I am getting is almost 50,000 rows, but the two tables, combined, contain only about 600 rows total. Here is the select statement - SELECT dealers.account_no, dealers.DealerName, blackgate_users.User_Name, blackgate_users.DealerName FROM dealers, blackgate_users WHERE dealers.account_no NOT LIKE blackgate_users.User_Name in these tables the dealers.account_no is the same data as the blackgate_users.User_Name dealers.DealerName is the same data as the blackgate_users.DealerName I just want the rows that are in the dealers table but not in the blackgate_users table. Thanks for any help, Chip Wiegand Computer Services Simrad, Inc 425-778-8821 425-771-7211 (FAX) -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: I can delete, add, but not update
Victor Pendleton [EMAIL PROTECTED] wrote on 08/17/2004 10:54:14 AM: Are there any errors being caught by the web form or being logged to the MySQL error log? I checked the log, there are no errors listed at all. It looks okay. No error message appears when running the script. I double checked my update script to make sure there were no spelling errors in the field names, and all looks good. It's just really strange. -- Chip -Original Message- From: Chip Wiegand To: [EMAIL PROTECTED] Sent: 8/17/04 11:29 AM Subject: I can delete, add, but not update I don't know for sure, but I think I may have something wrong with permissions in MySQL. I have some web forms from which I can add new data and delete data. But when I try to do an update of existing data the data is not actually changed. Is it possible that the permissions are not set up correctly in MySQL? Thanks, Chip Wiegand Computer Services Simrad, Inc 425-778-8821 425-771-7211 (FAX)
RE: I can delete, add, but not update
I found the problem - it was in an include file, not with the script. It had a variable that should have been changed from $address1 to $address, but wasn't in that one particular file. Anyway, thanks for the replies. -- Chip Victor Pendleton [EMAIL PROTECTED] wrote on 08/18/2004 01:09:25 PM: Can you log on as the web account and try to insert, update, select directly from the MySQL monitor? -Original Message- From: Chip Wiegand To: Victor Pendleton VPendleton Cc: '[EMAIL PROTECTED] ' Sent: 8/18/04 2:41 PM Subject: RE: I can delete, add, but not update Victor Pendleton [EMAIL PROTECTED] wrote on 08/17/2004 10:54:14 AM: Are there any errors being caught by the web form or being logged to the MySQL error log? I checked the log, there are no errors listed at all. It looks okay. No error message appears when running the script. I double checked my update script to make sure there were no spelling errors in the field names, and all looks good. It's just really strange. -- Chip -Original Message- From: Chip Wiegand To: [EMAIL PROTECTED] Sent: 8/17/04 11:29 AM Subject: I can delete, add, but not update I don't know for sure, but I think I may have something wrong with permissions in MySQL. I have some web forms from which I can add new data and delete data. But when I try to do an update of existing data the data is not actually changed. Is it possible that the permissions are not set up correctly in MySQL? Thanks, Chip Wiegand Computer Services Simrad, Inc 425-778-8821 425-771-7211 (FAX)
I can delete, add, but not update
I don't know for sure, but I think I may have something wrong with permissions in MySQL. I have some web forms from which I can add new data and delete data. But when I try to do an update of existing data the data is not actually changed. Is it possible that the permissions are not set up correctly in MySQL? Thanks, Chip Wiegand Computer Services Simrad, Inc 425-778-8821 425-771-7211 (FAX)
Re: problem importing .csv (excel format) into mysql
Joshua J. Kugler [EMAIL PROTECTED] wrote on 07/08/2004 04:24:41 PM: On Thursday 08 July 2004 02:35 pm, Chip Wiegand said something like: I was sent an excel file from a remote office, and need to put the data into a mysql database to be displayed on our web site. I removed a few lines of fluff from the excel file and saved it as .csv (using .csv (ms-dos)). When I try to import the file it gives me a duplicate entry for key 1 error. I have looked through the file and the duplicate item it is pointing to does not exist in the file. Here is the error: mysql load data infile '/usr/home/autopilots/whs4.csv' - into table refurbs - fields terminated by ',' - optionally enclosed by '' - lines terminated by '\n'; ERROR 1062: Duplicate entry '2147483647' for key 1 That sounds like you have a number that is too large for the field, and MySQL is rolling it over. What is the type of your key? Int? Big int? And what is in that field in the Excel file? What kind of numbers? Thanks for the tip. I'm a bit out of practice, I forgot to specify the column names - so field two was getting imported into the field 1 id column. Regards, Chip j- k- -- Joshua J. Kugler -- Fairbanks, Alaska -- ICQ#:13706295 Every knee shall bow, and every tongue confess, in heaven, on earth,and under the earth, that Jesus Christ is LORD -- Count on it! -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]
problem importing .csv (excel format) into mysql
I was sent an excel file from a remote office, and need to put the data into a mysql database to be displayed on our web site. I removed a few lines of fluff from the excel file and saved it as .csv (using .csv (ms-dos)). When I try to import the file it gives me a duplicate entry for key 1 error. I have looked through the file and the duplicate item it is pointing to does not exist in the file. Here is the error: mysql load data infile '/usr/home/autopilots/whs4.csv' - into table refurbs - fields terminated by ',' - optionally enclosed by '' - lines terminated by '\n'; ERROR 1062: Duplicate entry '2147483647' for key 1 (When I try to import through phpMyAdmin-2.5.6 it doesn't work also, keeps telling me to load a file, which is done by pressing Browse button.) Any ideas what could cause it to fail on a non-existant key? Is there a trick to loading Excel .csv files into mysql? Thanks -- Chip Wiegand Computer Services Simrad, Inc www.simradusa.com www.simrad.com [EMAIL PROTECTED] When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong. - R. Buckminster Fuller
Plz help quick - mysql/php/web server undefined function all of a sudden
I have a web server that uses mysql-4.1.0/apache-2.4.6/php-4.3.4 on freebsd-5.1. It has been working fine for the past few years, now all of a sudden today I get an undefined function error. This is from httpd-error.log - PHP Fatal error: Call to undefined function: mysql_connect() in /...stuff This is the connection function I am using - ? $conn=mysql_connect(localhost,user,) or die (Could not connect to the server); mysql_select_db(simradusa, $conn) or die (Could not get the database); ? If I comment out the above function the pages will load but of course none of the database stuff will load. If I leave the lines with the connect function uncommented the page fails to load altogether. As I mentioned - this just suddenly came about either today or over the weekend, I know it worked friday when I left the office. This particular machine has been up for 151 days 22 hours without a hiccup. thanks for the help, -- Chip Wiegand Computer Services Simrad, Inc www.simradusa.com [EMAIL PROTECTED] There is no reason anyone would want a computer in their home. --Ken Olson, president, chairman and founder of Digital Equipment Corporation, 1977 (Then why do I have 8? Somebody help me!) -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: [PHP] Plz help quick - mysql/php/web server undefined function all of a sudden
John W. Holmes [EMAIL PROTECTED] wrote on 05/03/2004 10:59:15 AM: From: Chip Wiegand [EMAIL PROTECTED] I have a web server that uses mysql-4.1.0/apache-2.4.6/php-4.3.4 on freebsd-5.1. It has been working fine for the past few years, now all of a sudden today I get an undefined function error. This is from httpd-error.log - PHP Fatal error: Call to undefined function: mysql_connect() in /...stuff I know you say that nothing changed but something obviously has. It looks like someone upgraded or reinstalled PHP but did not compile in MySQL support. Take a look at a phpinfo() page and see if there is a MySQL section. ---John Holmes... John, Yep, looking at phpinfo.php shows no support for mysql. This is very strange. I know these things don't just happen by themselves. I also know there are only two people with the password to the server, myself and my boss (and he knows nothing about the server to begin with). Anyway, looks like php needs to be configured to work with mysql. Now that it is the way it is, how do I go about that? According to pkg_info the version of php is 4.3.4_3. Being a port install how do I configure it to use mysql? Thanks, Chip -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Plz help quick - mysql/php/web server undefined function all of a sudden
Joshua J. Kugler [EMAIL PROTECTED] wrote on 05/03/2004 12:23:16 PM: It sounds like someone upgraded your PHP libraries, and forget to include MySQL support. Do you admin this server, or does someone else? j- k- Yep, I ran phpinfo.php and verified that it no longer shows support for mysql. Only two of have the password to the server, myself and my boss (who knows absolutely nothing about it). Now the question is - how do I configure php to support mysql when it is already installed from the ports? Do I do a whole new install again? I hope not. -- Chip On Monday 03 May 2004 09:20 am, Chip Wiegand said something like: I have a web server that uses mysql-4.1.0/apache-2.4.6/php-4.3.4 on freebsd-5.1. It has been working fine for the past few years, now all of a sudden today I get an undefined function error. This is from httpd-error.log - PHP Fatal error: Call to undefined function: mysql_connect() in /...stuff This is the connection function I am using - ? $conn=mysql_connect(localhost,user,) or die (Could not connect to the server); mysql_select_db(simradusa, $conn) or die (Could not get the database); ? If I comment out the above function the pages will load but of course none of the database stuff will load. If I leave the lines with the connect function uncommented the page fails to load altogether. As I mentioned - this just suddenly came about either today or over the weekend, I know it worked friday when I left the office. This particular machine has been up for 151 days 22 hours without a hiccup. thanks for the help, -- Chip Wiegand Computer Services Simrad, Inc www.simradusa.com [EMAIL PROTECTED] There is no reason anyone would want a computer in their home. --Ken Olson, president, chairman and founder of Digital Equipment Corporation, 1977 (Then why do I have 8? Somebody help me!) -- Joshua J. Kugler -- Fairbanks, Alaska -- ICQ#:13706295 Every knee shall bow, and every tongue confess, in heaven, on earth,and under the earth, that Jesus Christ is LORD -- Count on it! -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
out of memory error and update problem
When running mysql from the command line (Putty terminal) and trying to do some updates the updates fail. First the query I am running - mysql update warranty_temp, warranty_old set warranty_old.OwnerName=warranty_temp.OwnerName where warranty_old.WarrantyID between 75 and 100 AND warranty_temp.WarrantyID between 75 and 100; Query OK, 119 rows affected (50.97 sec) Rows matched: 14641 Changed: 119 Warnings: 0 The results of this query are that the OwnerName in record 75 is copied into the OwnerName for records 75 thru 100. That shouldn't be, there should be a differant OwnerName for each row being copied into each row of the target table. Now the table has 119 rows with the same OwnerName. I have also tried - mysql update warranty_old, warranty_temp set warranty_old.OwnerName=warranty_temp.OwnerName where warranty_old.WarrantyID = warranty_temp.WarrantyID; This copied the OwnerName in row 1 into the OwnerName of every row in the table. Seems the only way to get this to work is to update every row individually - mysql update warranty, warranty_old set warranty.OwnerName=warranty_old.OwnerName where warranty.WarrantyID='39' AND warranty_old.WarrantyID='39'; which works, but there are thousands of rows to update. Now the memory error - when trying to run a large update, it fails and the log file contains this message - 040324 14:36:22 Out of memory; Check if mysqld or some other process uses all available memory. If not you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap space I don't know what 'ulimit' is. The server has 512 megs of swap space, I opened a second Putty terminal and watched top while running the update statements in another window and MySQL uses 95% of the memory while processing but the swap never gets touched (shows only 40K used). The server has 768megs ram, 600mhz Athlon processor. I just checked the dmesg messages and found this - pid 18729 (mysqld), uid 88 inumber 32818 on /: filesystem full so I ran this - su-2.05b# df -H FilesystemSize Used Avail Capacity Mounted on /dev/ad0s1a 508M 346M 121M74%/ devfs 1.0K 1.0K 0B 100%/dev /dev/ad0s1d14G 2.9G 9.9G22%/usr File system is not full, what's it talking about? What would be the recommended remedies? -- Chip Wiegand Computer Services Simrad, Inc www.simradusa.com [EMAIL PROTECTED] There is no reason anyone would want a computer in their home. --Ken Olson, president, chairman and founder of Digital Equipment Corporation, 1977 (Then why do I have 8? Somebody help me!) -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
select statement not working in a php page
I am trying to get a single result from a database, which works fine at the sql command line. I have tried several versions of code, this being the most recent - ? $sql = select max(WarrantyID) from warrantycopy; $result=mysql_query($sql) or die(Could not get the id number : . mysql_error()); while($query_data = mysql_fetch_array($result)) { $WarrantyID = $query_data[WarrantyID]; echo tr\n; echo thWarranty ID:/th\n; echo td$WarrantyID/td\n; echo /tr\n; } ? No matter what I do I do not get the desired max id number from the column WarrantyID. The same query works fine at the sql command line. What am I doing wrong? thanks -- Chip -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: select statement not working in a php page
Thanks for the tip. Got it working. -- Chip Rick Emery [EMAIL PROTECTED] wrote on 03/22/2004 09:50:59 AM: What result are you getting? First off, I see that your HTML is possibly incorrect; should it be: echo tdWarranty ID:/td\n; th is a table header. Second, if you are expecting a single result row, then you do not need the while() loop. Do a single fetch and display the result. rick People will forget what you said. People will forget what you did. But people will never forget how you made them feel. - Original Message - From: Chip Wiegand [EMAIL PROTECTED] To: MySQL [EMAIL PROTECTED] Sent: Monday, March 22, 2004 11:33 AM Subject: select statement not working in a php page I am trying to get a single result from a database, which works fine at the sql command line. I have tried several versions of code, this being the most recent - ? $sql = select max(WarrantyID) from warrantycopy; $result=mysql_query($sql) or die(Could not get the id number : . mysql_error()); while($query_data = mysql_fetch_array($result)) { $WarrantyID = $query_data[WarrantyID]; echo tr\n; echo thWarranty ID:/th\n; echo td$WarrantyID/td\n; echo /tr\n; } ? No matter what I do I do not get the desired max id number from the column WarrantyID. The same query works fine at the sql command line. What am I doing wrong? thanks -- Chip -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: update question
On Sun, 2 Mar 2003 02:06:40 -0500 Tore Bostrup [EMAIL PROTECTED] wrote: I assume you are storing your dates in a char/varchar column - not a good choice to start with... :- yes, varchar. I'm still learning this stuff, and experimenting with it. Assuming all the values are supposed to be stored as MM-DD-YY (anothoer marginal choice, but the problem may not rear its head again for another 96+ years), you can do the following: heh, heh, I don't think I'll be around another 96 years to find out. Lets see, I would be 139 years old. Probably wouldn't be pushing too many keys on the keyboard at that age. This particular database/tables are not for business use, just my own learning. UPDATE mytable SET mydatestr = LEFT(mydatestr, LENGTH(mydatestr) - 3) WHERE mydatestr LIKE '__-__-__-__' Thanks for the help, worked great. I didn't know about the underscore being a wildcard character. I should look for a better MySQL book, the ones I have don't cover that info. Any suggestions for one that does? -- Chip HTH, Tore. - Original Message - From: chip wiegand [EMAIL PROTECTED] To: mysql [EMAIL PROTECTED] Sent: Sunday, March 02, 2003 1:46 AM Subject: update question I need to make a change to a field in a table and don't know how to write the correct sql statement. I made an error and now have a date field with the year repeated twice - 01-01-03-03 - there are aproximately 100 rows like this, and maybe 20 or so that are formatted properly. How can I remove the last 3 characters while leaving other rows that do not have this problem alone? (other than manaully editing each row of course) Thanks, Chip W. www.wiegand.org --- -- 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 - 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 - 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: update question
On Sun, 2 Mar 2003 17:58:13 -0500 Tore Bostrup [EMAIL PROTECTED] wrote: Personally, I usually like Reference books better than Idiot's Guide books. And my favorite reference handbook for the SQL language (ANSI SQL-92 standard) is Martin Gruber, SQL Instant Reference (SYBEX). There is (was) at least a 2nd edition available. No fluff, just standard syntax and a good description of the key things you need to know for writing SQL queries. You'll still need to check the MySQL documentation to find out what is/isn't supported, what differes froim the standard, and what specific functions are available, etc. HTH, Tore. Thanks, after reviewing my 'library' I find the books I have with mysql info are PHP books that have a chapter or two on MySQL. So, I'll have to buy a SQL book specifically. Regards, Chip - Original Message - From: chip wiegand [EMAIL PROTECTED] To: Tore Bostrup [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Sunday, March 02, 2003 4:25 PM Subject: Re: update question On Sun, 2 Mar 2003 02:06:40 -0500 Tore Bostrup [EMAIL PROTECTED] wrote: I assume you are storing your dates in a char/varchar column - not a good choice to start with... :- yes, varchar. I'm still learning this stuff, and experimenting with it. Assuming all the values are supposed to be stored as MM-DD-YY (anothoer marginal choice, but the problem may not rear its head again for another 96+ years), you can do the following: heh, heh, I don't think I'll be around another 96 years to find out. Lets see, I would be 139 years old. Probably wouldn't be pushing too many keys on the keyboard at that age. This particular database/tables are not for business use, just my own learning. UPDATE mytable SET mydatestr = LEFT(mydatestr, LENGTH(mydatestr) - 3) WHERE mydatestr LIKE '__-__-__-__' Thanks for the help, worked great. I didn't know about the underscore being a wildcard character. I should look for a better MySQL book, the ones I have don't cover that info. Any suggestions for one that does? -- Chip HTH, Tore. - Original Message - From: chip wiegand [EMAIL PROTECTED] To: mysql [EMAIL PROTECTED] Sent: Sunday, March 02, 2003 1:46 AM Subject: update question I need to make a change to a field in a table and don't know how to write the correct sql statement. I made an error and now have a date field with the year repeated twice - 01-01-03-03 - there are aproximately 100 rows like this, and maybe 20 or so that are formatted properly. How can I remove the last 3 characters while leaving other rows that do not have this problem alone? (other than manaully editing each row of course) Thanks, Chip W. www.wiegand.org --- -- 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 - 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 - 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 - 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
update question
I need to make a change to a field in a table and don't know how to write the correct sql statement. I made an error and now have a date field with the year repeated twice - 01-01-03-03 - there are aproximately 100 rows like this, and maybe 20 or so that are formatted properly. How can I remove the last 3 characters while leaving other rows that do not have this problem alone? (other than manaully editing each row of course) Thanks, Chip W. www.wiegand.org - 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
load data infile command not allowed problem - revised
I access a msyql server (apache/mysql/php) from my w2k workstation using phpMyAdmin. I do not have command line access. When I use the link to load a local data file it responds that it is not allowed. I read the mysql docs and see it is now disabled by default. In 4.2.4 one paragraph says If you don't configure MySQL with --enable-local-infile, then LOAD DATA LOCAL will be disabled by all clients, and just below that in another paragraph it says By default, all MySQL clients and libraries are compiled with --enable-local-infile. Which is it? Default with or without? Evidently it defaults to not enabled. The server is running MySQL-3.23.52. I have added local-infile = 1 to my.cnf in the [client], [mysqld] and [mysql] sections. This has not helped at all. How do I run phpMyAdmin to give me the ability to upload a local data file to a mysql server that doesn't allow this? thanks, -- Chip Wiegand Computer Services Simrad, Inc www.simradusa.com [EMAIL PROTECTED] There is no reason anyone would want a computer in their home. --Ken Olson, president, chairman and founder of Digital Equipment Corporation, 1977 (Then why do I have 8? Somebody help me!) - 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 - 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
load data infile command not allowed problem
I access a msyql server (apache/mysql/php) from my w2k workstation using phpMyAdmin. I do not have command line access. When I use the link to load a local data file it responds that it is not allowed. I read the mysql docs and see it is now disabled by default. In 4.2.4 one paragraph says If you don't configure MySQL with --enable-local-infile, then LOAD DATA LOCAL will be disabled by all clients, and just below that in another paragraph it says By default, all MySQL clients and libraries are compiled with --enable-local-infile. Which is it? Default with or without? Evidently it defaults to not enabled. The server is running MySQL-3.23.52. How do I run phpMyAdmin to give me the ability to upload a local data file to a mysql server that doesn't allow this? thanks, -- Chip Wiegand Computer Services Simrad, Inc www.simradusa.com [EMAIL PROTECTED] There is no reason anyone would want a computer in their home. --Ken Olson, president, chairman and founder of Digital Equipment Corporation, 1977 (Then why do I have 8? Somebody help me!) - 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
db dump question
I need to copy a database and all its tables and contents to a backup server. The server they live on is on an ISP, the server I want to back the up on is in my office in another town. I can access the ISP's server via phpMyAdmin and dump the data to a .sql file, but then what do I do to recreate the database and all the tables on my local mysql server? What do I look for in the manual? -- Chip - 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: db dump question
On Thu, 2002-09-26 at 18:28, Mihail Manolov wrote: mysql datadump.sql Thanks, I finally found it. the mysql manual doesn't have anything about exporting/importing, I was using the wrong words for searching. -- Chip - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, September 26, 2002 4:44 PM Subject: db dump question I need to copy a database and all its tables and contents to a backup server. The server they live on is on an ISP, the server I want to back the up on is in my office in another town. I can access the ISP's server via phpMyAdmin and dump the data to a .sql file, but then what do I do to recreate the database and all the tables on my local mysql server? What do I look for in the manual? -- Chip - 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 - 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 - 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 know it's not supposed to be this difficult to install
I am trying to get mysql-server installed from the FreeBSD port but keep getting this dog-gone error - mysqld started Can't start server: Bind on unix socket: Permission denied Do you already have another mysqld server running on socket: /tmp/mysql.sock? Aborting Okay, so, I do a ps -aux | grep mysql and get nothing, as well as for mysqld. So it's not running. I change permissions on /tmp/mysql.sock to 777 and it still fails, I change ownership to mysql and it still fails - always with the same errror. I rebooted, mysqld is trying to start at bootup, but the log just shows the same error. I copied my-medium.cnf to /etc/my.cnf and verified it is pointing to /tmp/mysql.sock. I even went to far as to delete mysql.sock and create a new one, owned by mysql with wide open permissions, and it still fails, same message. What the heck am I doing wrong? besides installing from the port? -- Chip - 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: I know it's not supposed to be this difficult to install
On Tue, 2002-09-17 at 16:30, Robert Citek wrote: Hello Chip, Try 'rm /tmp/mysql.sock' MySQL creates a new one at startup. - Robert Tried that, it didn't create a new one. It still gives the same error also, as if it is there. I've installed previous versions of mysql a dozen times and have never had this trouble. -- Chip At 04:19 PM 9/17/2002 -0700, Chip Wiegand wrote: I am trying to get mysql-server installed from the FreeBSD port but keep getting this dog-gone error - mysqld started Can't start server: Bind on unix socket: Permission denied Do you already have another mysqld server running on socket: /tmp/mysql.sock? Aborting Okay, so, I do a ps -aux | grep mysql and get nothing, as well as for mysqld. So it's not running. I change permissions on /tmp/mysql.sock to 777 and it still fails, I change ownership to mysql and it still fails - always with the same errror. I rebooted, mysqld is trying to start at bootup, but the log just shows the same error. I copied my-medium.cnf to /etc/my.cnf and verified it is pointing to /tmp/mysql.sock. I even went to far as to delete mysql.sock and create a new one, owned by mysql with wide open permissions, and it still fails, same message. What the heck am I doing wrong? besides installing from the port? - 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
select box result on page1 to insert statement table name on page2- not working
I first posted this on the php-db list, but am not getting the proper results yet, so I am copying here, hopefully someone can help me figure this one out... I have a form with a select list and a hidden field to save the selected item. On submit another page is loaded with a few fields to be filled in and submitted to a table. Using get I see the data is being passed from the first page to the second properly, and the second page sends its data properly. The hidden field from the first page is to be used by the second page as the name of the table in the query. I have a place where I echo the contents of the hidden field just to be sure it is correct, and that does indeed show what I expect. I then make the query statement point to the variable but it always responds that it cannot find the table. The table does exist, the variable does contain the appropriate table name, but is not being replaced by the name. What am I doing wrong? On Sat, 2002-08-03 at 06:05, Rich Hutchins wrote: Try referencing the $listbox variable in you SQL statement like this: $sql = insert into .$listbox. values(NULL,'$date','$exercise','$reps','$comments'); I'm guessing that it might also work like this: $sql = insert into '$listbox' values(NULL,'$date','$exercise','$reps','$comments'); I think your core problem is that the $listbox variable is not being evaluated properly in the SQL statement. Once you solve that, you're good to go. Hope this helps. Rich I tried both suggestions and neither are working. I am using the get format for the form so I can see what is being sent, and I am getting this: http://192.168.1.53/workout-absflexor.php?exerciselist=%24listboxexercise=80 reps=12comments=submit=Send+Data Notice that the $listbox variable is still not being sent. Notice the two echo statements both of which shows what's in that variable, and it displays the expected result (see code below). I am at a loss as to why the one in the sql insert statement is not working. If I replace the $listbox variable with the table name shown in the echo statement, a connection is made and the query is completed. -- Chip W www.wiegand.org [EMAIL PROTECTED] Below is the code for the first page -- html head title/title /head body div align=center ? $exercises=array(absflexor,absmachine,leglifts); echo form action='workout-absflexor.php' method='get'; echo table width='70%' border='0' align='center'; echo trth align='center'h2Exercise Data Input/h2/th/tr; echo trth align='center'select name='listbox'; echo option$exercises[0]/option; echo option$exercises[1]/option; echo option$exercises[2]/option; echo /selectbrbr; echo /th/tr/table; echo input type='hidden' name='exerciselist' value='$listbox'; echo input type='submit'; echo /form; ? /div /body /html And below is the code for the second page (the form hidden field was later added, but still no good) (the echo statement at the bottom was later added to verify the variable) -- !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns=http://www.w3.org/1999/xhtml; head titleWorkout Data Entry Form/title style type=text/css body { background-color: aqua; } div.c1 {text-align: center} /style /head body div class=c1 h2Work-Out Data Entry Screen/h2 form action=? PHP_SELF ? method=get input type='hidden' name='exerciselist' value='$listbox' table summary= width=60% border=1 align=center bgcolor=green tr thWeight/th td align=leftinput type=text name=exercise maxlength=4/td /tr tr thReps/th td align=leftinput type=text name=reps maxlength=4/td /tr tr thComments/th td colspan=2textarea cols=50 rows=3 name=comments /textarea/td /tr trtd? echo $listbox; ?/td/tr /table br / input type=submit name=submit value=Send Data / input type=reset / /form /div ? if(isset($submit)): $db = mysql_connect(localhost,root,carvin); if(!$db) error_message(sql_error()); mysql_select_db(workout,$db) or die (Ack! Where's the database?); $date = date(m-d); $sql = insert into .$listbox. values(NULL,'$date','$exercise','$reps','$comments'); mysql_query($sql) or die (Ack! No response when I queried the server!); endif; echo $listbox; ? /body /html - 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: export table?
On Mon, 2002-07-08 at 04:42, Victoria Reznichenko wrote: What about mysqldump? http://www.mysql.com/doc/m/y/mysqldump.html You can make dump file of your table, copy from one server to another and restore table or mysqldump database_name table_name | mysql -hhost_name -uuser_name database_name Thanks, if I'd known export was called mysqldump, I would've searched on that instead of export. Seems there should be a reference to export that would point to mysqldump in the manual or online docs somewhere, IMO. (but then again, maybe I'm the only person to ever search for export.) :-) Thanks for the help, -- Chip -- For technical support contracts, goto https://order.mysql.com/?ref=ensita This email is sponsored by Ensita.net http://www.ensita.net/ __ ___ ___ __ / |/ /_ __/ __/ __ \/ /Victoria Reznichenko / /|_/ / // /\ \/ /_/ / /__ [EMAIL PROTECTED] /_/ /_/\_, /___/\___\_\___/ MySQL AB / Ensita.net ___/ www.mysql.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
export table?
Where is info on exporting a table? I checked the mysql docs and the only reference to export has nothing to do with exporting a table. I want to copy a table from one server to another, should be simple enough, right? -- Chip [EMAIL PROTECTED] www.wiegand.org - 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
Finding out whos using the database
Is there a command that I can use to find out how many people, or more specifically, who, is using the database? I tried the mysql web site but the search result are more irrelevant than relevant. Thanks, Chip W www.wiegand.org [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: select statement group by unusual results
DL Neil [EMAIL PROTECTED] on 12/06/2001 12:26:45 AM Internet mail from: Please respond to DL Neil [EMAIL PROTECTED] To: [EMAIL PROTECTED] cc: [EMAIL PROTECTED] Subject: Re: select statement group by unusual results Chip, I have a database with 12 tables. I am running a query to select certain fields from 3 of the tables, like this - select Title, Details, StartDate, City, State from phpCalendar_Details, phpCalendar_Daily, phpCalendar_EventLocations where phpCalendar_Details.EventLocationID = phpCalendar_EventLocations.EventLocationID group by City; The problem is the StartDate field data for the first returned row is carried down through all the rows, rather than picking up the correct StartDate data. All the other data is picked up correctly. When I change group by to State or Title or any field, I get the same problem, whatever the first returned field, it is carried down through all the rows. How do I get around this, or what am I doing wrong? |From this can we assume (you don't give table schema) that StartDate is in the |phpCalendar_Daily table and is |the only field selected from that table? | |Take a look at the WHERE clause: the query is using three tables but only joins two. | |Is that it? |=dn I guess I left a bit out. Here's the set up - 3 tables are phpCalendar_Details (fields are Title, Details), phpCalendar_Daily (field StartDate) , phpCalendar_EventLocations (fields are City, State). Two tables (_Details and _EventLocations) have a common field - EventLocationID, the third table does not have a field common to those two tables. I suppose I have to have one common to all 3 to make it work? |=you got it - that's why they're called relational databases! |-otherwise there is no way of working out which row/StartDate from the phpCalendar_Daily |table is relevant to |the Event being described be the other two tables' data. | |=Should you be thinking about having an EventID which appears in both the |phpCalendar_Details and |phpCalendar_Daily tables - or collapsing the StartDate into the phpCalendar_Details table? |Either way, it is |beginning to sound like a db design/normalisation issue rather than a query-writing |problem. | |=Hope it helps, |=dn Thanks for the tips. So here's my latest attemp: select distinct Title, Details, StartDate, StopDate, City, State from phpCalendar_Details t1, phpCalendar_Daily t2, phpCalendar_EventLocations t3 where t1.LocationID = t2.LocationID and t1.EventLocationID = t3.EventLocationID group by StartDate; And this one works! Amazing, my first attempt at a join statement. Thanks again, Chip W. - 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: select statement group by unusual results
DL Neil [EMAIL PROTECTED] on 12/06/2001 05:27:55 PM Internet mail from: Please respond to DL Neil [EMAIL PROTECTED] To: [EMAIL PROTECTED] cc: [EMAIL PROTECTED] Subject: Re: select statement group by unusual results Hi Chip, Thanks for the tips. So here's my latest attemp: select distinct Title, Details, StartDate, StopDate, City, State from phpCalendar_Details t1, phpCalendar_Daily t2, phpCalendar_EventLocations t3 where t1.LocationID = t2.LocationID and t1.EventLocationID = t3.EventLocationID group by StartDate; And this one works! Amazing, my first attempt at a join statement. |=it works, great! Join our happy throng of MySQL-ers! | |but... |(I'm going to make loads of assumptions because you have changed the schema of two or even |all three of the |involved tables (since describing them before) - it works, so that's not bothering me) |What is? |1 why use DISTINCT? |ie what do you think it is contributing to the query result? Actually, it isn't contributing anything, it was left over from my experimenting. I took it out and it still works fine. |2 why use GROUP BY? |ie what do you want to happen if there is more than one event starting on the same date? Turns out the results are slightly differant with or withou group by - I get 20 results with group by and 32 results without it. I should only be getting 20 results, right now I don't have time to figure out where the odd results are coming from when not using group by. I'll check into that later. |Yes relational algebra can be fun - provided you didn't sleep through set theory etc at |school. Relational aglebra? I haven't a clue what that is. Set theory? Don't know what that is either. |Congratulations |on your success, that is an inner join and in fact is also a equi-join (and there's |plenty of other jargon |that you can use to describe it). Your first example had a join in its WHERE clause too - |did you mean that this |is your first multi-way join? This is the first join of any type I have had to make. So far my databases have been simple with just a single table. This one in particular I got off the web, it's a calendar app, quite nice one too,from appIdeas.com. I have to send the data in csv to our parent company in Norway. I'm also doing a dump just so they get everything. I don't know what they're using for sql server or just exactly they want from me, they just want the data. (They're taking some of my work away from me, the dirty rats) :-( |Now is the time when all good (wo)men go out and pick up a |decent text and get |stuck in... | |Regards, |=dn I picked up a book called MySQL/PHP Database Applications by Greenspan Bulger, seems to pretty good, and a couple other php books that have a little mysql stuff. -- Regards, Chip - 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
select statement group by unusual results
I have a database with 12 tables. I am running a query to select certain fields from 3 of the tables, like this - select Title, Details, StartDate, City, State from phpCalendar_Details, phpCalendar_Daily, phpCalendar_EventLocations where phpCalendar_Details.EventLocationID = phpCalendar_EventLocations.EventLocationID group by City; The problem is the StartDate field data for the first returned row is carried down through all the rows, rather than picking up the correct StartDate data. All the other data is picked up correctly. When I change group by to State or Title or any field, I get the same problem, whatever the first returned field, it is carried down through all the rows. How do I get around this, or what am I doing wrong? Thanks, Chip - 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: select statement group by unusual results
DL Neil [EMAIL PROTECTED] on 12/05/2001 11:35:46 PM Internet mail from: Please respond to DL Neil [EMAIL PROTECTED] To: [EMAIL PROTECTED], [EMAIL PROTECTED] cc: Subject: Re: select statement group by unusual results Chip, I have a database with 12 tables. I am running a query to select certain fields from 3 of the tables, like this - select Title, Details, StartDate, City, State from phpCalendar_Details, phpCalendar_Daily, phpCalendar_EventLocations where phpCalendar_Details.EventLocationID = phpCalendar_EventLocations.EventLocationID group by City; The problem is the StartDate field data for the first returned row is carried down through all the rows, rather than picking up the correct StartDate data. All the other data is picked up correctly. When I change group by to State or Title or any field, I get the same problem, whatever the first returned field, it is carried down through all the rows. How do I get around this, or what am I doing wrong? |From this can we assume (you don't give table schema) that StartDate is in the |phpCalendar_Daily table and is |the only field selected from that table? | |Take a look at the WHERE clause: the query is using three tables but only joins two. | |Is that it? |=dn I guess I left a bit out. Here's the set up - 3 tables are phpCalendar_Details (fields are Title, Details), phpCalendar_Daily (field StartDate) , phpCalendar_EventLocations (fields are City, State). Two tables (_Details and _EventLocations) have a common field - EventLocationID, the third table does not have a field common to those two tables. I suppose I have to have one common to all 3 to make it work? -- Chip - 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
Rename a Database?
I searched the archives and the manual online but could not find the answer, I believe this has been covered in the list though. Is it possible to rename a database? If not, is it possible to move/copy a table from a database to a new database? Could someone point me to the details on this? -- Chip - 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
getting multiple columns per row from databse query
I have a database that is names and addresses. I want to make a web page that will display those names and addresses in a table with 4 columns per row, as many rows as necessary. The little if statement below works to make 2 columns, but when I change the number to 3 or higher it no longer works properly - I get the 3 or more columns wrapped to look like multiple rows. (there's on long line, hopefully it will wrap properly). ? (html and connection lines snipped)... $sql = select * from brochures; $result = mysql_query($sql); while ($row = mysql_fetch_array($result)) { printf(td%sbr%sbr%sbr%sbr%sbr%s, %s %s/td\n, $row[Account], $row[name], $row[email], $row[Address], $row[Address2], $row [City], $row[State], $row[Zip]); if ($i % 2) { echo /tr\ntr\n; } $i++; } ? -- Chip W - 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: getting multiple columns per row from databse query
Thanks Bill, That works great. Much appreciative, Chip Bill Adams [EMAIL PROTECTED]@tqs.com on 11/15/2001 10:31:45 PM Internet mail from: Sent by: [EMAIL PROTECTED] To: [EMAIL PROTECTED] cc: [EMAIL PROTECTED] Subject: Re: getting multiple columns per row from databse query Try: $i++; if( $i % 3 == 0 ){ echo /tr\ntr\n; } b. mysql [EMAIL PROTECTED] wrote: I have a database that is names and addresses. I want to make a web page that will display those names and addresses in a table with 4 columns per row, as many rows as necessary. The little if statement below works to make 2 columns, but when I change the number to 3 or higher it no longer works properly - I get the 3 or more columns wrapped to look like multiple rows. (there's on long line, hopefully it will wrap properly). ? (html and connection lines snipped)... $sql = select * from brochures; $result = mysql_query($sql); while ($row = mysql_fetch_array($result)) { printf(td%sbr%sbr%sbr%sbr%sbr%s, %s %s/td\n, $row [Account], $row[name], $row[email], $row[Address], $row [Address2], $row [City], $row[State], $row[Zip]); if ($i % 2) { echo /tr\ntr\n; } $i++; } ? -- Chip W - 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 -- Bill Adams TriQuint Semiconductor - 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
linking to a database id
I have a database of dealers. A web page loads a list of states, a user clicks on the state and the database is queried and lists in a table the dealers for that state. Simple enough. When the dealers page is first loaded, it shows all dealers in the database, name, address, phone, etc. I want to change that to just the dealer names linked to their state listing. I can get the page to display the dealer names okay, but when I try to get the link to work it just reloads the currant page. The url shows the correct information. I shouldn't have to designate a seperate page to show the results should I? I don't want to, I want this to be the default that loads when the page is loaded. I have this code snippet below, that when I click on the the link in the web page, the url shows the correct info for the page, but it does not load, it just reloads the same current page. Thanks for the help... -- Chip --- lots of elseif statements trimmed -- elseif ($orderby == '46'): $query = select * from dealers where ID = '46' order by 'DealerName' asc; else: $query = select * from dealers; endif; $result = mysql_query($query); $i = 0; while ( $row = mysql_fetch_array($result)) { if ($result): { printf(tda href=\http://www.mapquest.com/cgi-bin/ia_free?width=500height=600level=8streetaddress=%scity=%sstate=%s\; target=\_new\%s/a \n, $row[Address1], $row[City], $row[State], $row[DealerName]); printf(br%s\n, $row[Address1]); printf(br%s\n, $row[Address2]); printf(br%s, %s %s\n, $row[City], $row[State], $row[Zipcode]); printf(brPhone: %s\n, $row[Phone]); printf(brFAX: %s\n, $row[FAX]); printf(br\na href=\mailto:%s\;%s/a\n, $row[Email], $row[Email]); print(/td\n); if ($i % 2) { echo /tr\ntr\n; } $i++; } else: printf(td.$row[ID]. a href='dealerDB2.php?ID=$row[ID]'%s/a, $row[DealerName]); print(/td); if ($i % 2) { echo /tr\ntr\n; } $i++; endif; } ? - 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 blew it big time... locked myself out of mysql
I used mysqladmin to create a database and set the grant properties to root@localhost with the password, but now am unable to use mysql at all. How can I rectify this problem? When I try to access mysql I get 'Access denied for user root@localhost'. I have tried, from the command line, with -uroot -ppassword and get the same results. Please help ASAP. I have always been able to connect as root with just 'mysql' at the prompt. -- Chip Wiegand Computer Services www.simradusa.com [EMAIL PROTECTED] Simrad, Inc Lynnwood, WA 425-712-1138 There is no reason anyone would want a computer in their home. --Ken Olson, president, chairman and founder of Digital Equipment Corp., 1977 (-- Then why do I have nine? Somebody help me!) - 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: I blew it big time... locked myself out of mysql
Thanks for all the replies, I have followed the instructions in the manual and am still getting an error, here is the message: --- simrad_4# safe_mysqld --skip-grant-tables [1] 57953 simrad_4# Starting mysqld daemon with databases from /var/db/mysql simrad_4# mysql Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 to server version: 3.23.38 Type 'help;' or '\h' for help. Type '\c' to clear the buffer mysql grant all privileges on *.* to root@localhost identified by 'xx'; ERROR 1047: Unknown command I have tried a number of variations on the grant statement above but they all fail with the same message. More suggestions? -- Chip Hans Zaunere [EMAIL PROTECTED] on 08/14/2001 07:37:55 PM Internet mail from: To: [EMAIL PROTECTED] cc: [EMAIL PROTECTED] Subject: Re: I blew it big time... locked myself out of mysql This link, http://www.mysql.com/doc/P/r/Problems.html is a life-saver. Check out A.9 for your specific problem. Hans [EMAIL PROTECTED] wrote: I used mysqladmin to create a database and set the grant properties to root@localhost with the password, but now am unable to use mysql at all. How can I rectify this problem? When I try to access mysql I get 'Access denied for user root@localhost'. I have tried, from the command line, with -uroot -ppassword and get the same results. Please help ASAP. I have always been able to connect as root with just 'mysql' at the prompt. -- Chip Wiegand Computer Services www.simradusa.com [EMAIL PROTECTED] Simrad, Inc Lynnwood, WA 425-712-1138 There is no reason anyone would want a computer in their home. --Ken Olson, president, chairman and founder of Digital Equipment Corp., 1977 (-- Then why do I have nine? Somebody help me!) - 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 (See attached file: hz11.vcf) - 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: I blew it big time... locked myself out of mysql
[EMAIL PROTECTED]@bellsouth.net on 08/14/2001 10:03:13 PM Internet mail from: Please respond to [EMAIL PROTECTED] To: [EMAIL PROTECTED] cc: [EMAIL PROTECTED], [EMAIL PROTECTED] Subject: Re: I blew it big time... locked myself out of mysql On Tue, 14 Aug 2001 12:16:59 -0700, [EMAIL PROTECTED] wrote: Thanks for all the replies, I have followed the instructions in the manual and am still getting an error, here is the message: --- simrad_4# safe_mysqld --skip-grant-tables [1] 57953 simrad_4# Starting mysqld daemon with databases from /var/db/mysql simrad_4# mysql Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 to server version: 3.23.38 Type 'help;' or '\h' for help. Type '\c' to clear the buffer mysql grant all privileges on *.* to root@localhost identified by 'xx'; ERROR 1047: Unknown command that should be: grant all on *.* to root@localhost identified by 'xx' with grant option; Turns out I get the same error message when I try the command that way too. -- Chip 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: I blew it big time... locked myself out of mysql
Werner Stuerenburg [EMAIL PROTECTED] on 08/14/2001 11:55:37 PM Internet mail from: Please respond to Werner Stuerenburg [EMAIL PROTECTED] To: [EMAIL PROTECTED] cc: Subject: Re: I blew it big time... locked myself out of mysql I think it is grant all on *.* to 'root'@'localhost' identified by 'xx' with grant - Here's what I tried - what could possibly be wrong with this? mysql grant all on *.* to 'root'@'localhost' - identified by 'xx' - with grant option; ERROR 1047: Unknown command mysql grant all on * to 'root'@'localhost' - identified by 'xx' - with grant option; ERROR 1047: Unknown command Still not working. -- chip -- [EMAIL PROTECTED] schrieb am Dienstag, 14. August 2001, 22:54:48: [EMAIL PROTECTED]@bellsouth.net on 08/14/2001 10:03:13 PM Internet mail from: Please respond to [EMAIL PROTECTED] To: [EMAIL PROTECTED] cc: [EMAIL PROTECTED], [EMAIL PROTECTED] Subject: Re: I blew it big time... locked myself out of mysql On Tue, 14 Aug 2001 12:16:59 -0700, [EMAIL PROTECTED] wrote: Thanks for all the replies, I have followed the instructions in the manual and am still getting an error, here is the message: --- simrad_4# safe_mysqld --skip-grant-tables [1] 57953 simrad_4# Starting mysqld daemon with databases from /var/db/mysql simrad_4# mysql Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 to server version: 3.23.38 Type 'help;' or '\h' for help. Type '\c' to clear the buffer mysql grant all privileges on *.* to root@localhost identified by 'xx'; ERROR 1047: Unknown command that should be: grant all on *.* to root@localhost identified by 'xx' with grant option; Turns out I get the same error message when I try the command that way too. -- Chip 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 -- Herzlich Werner Stuerenburg _ ISIS Verlag, Teut 3, D-32683 Barntrup-Alverdissen Tel 0(049) 5224-997 407 ยท Fax 0(049) 5224-997 409 http://pferdezeitung.de - 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
My databases got hosed when the server went down hard!
Geez, if it ain't one thing it's another. :-( My fbsd server went down hard today, now my mysql database is supposedly gone. I see the .MYD, .MYI, and .FRM files in the /usr/var/db/mysql/ directory, but I get this - mysql use bulletins Can't read dir of './bulletins/' (Errcode: 13) Database changed mysql show tables; ERROR 12: Can't read dir of './bulletins/' (Errcode: 13) mysql myisamchk -s /usr/var/db/mysql/bulletins/*.MYI; ERROR 1064: You have an error in your SQL syntax near 'myisamchk -s /usr/var/db/mysql /bulletins/*.MYI' at line 1 Obviously I don't know how to use myisamchk properly. In Webmin I see the icons for the database, but when I select it the screen changes and shows This database has no tables. Hopefully these files can be restored, I can view them with cat and they do contain the data that was entered previously. Chip Wiegand Computer Services www.simradusa.com [EMAIL PROTECTED] Simrad, Inc Lynnwood, WA 425-712-1138 There is no reason anyone would want a computer in their home. --Ken Olson, president, chairman and founder of Digital Equipment Corp., 1977 (-- Then why do I have nine? Somebody help me!) - 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: My databases got hosed when the server went down hard!
Thankyou, that fixed it. Man, I was concerned I'd have to rebuild those databases and re-enter all the data. thanks for the help, -- Chip [EMAIL PROTECTED] on 08/07/2001 11:35:31 PM Internet mail from: To: [EMAIL PROTECTED] cc: [EMAIL PROTECTED] Subject: Re: My databases got hosed when the server went down hard! Your permissions are wrong on one of the directories. Make sure that the 'mysql' user has the correct permission to the ./mysql directory. [EMAIL PROTECTED] wrote: I see the .MYD, .MYI, and .FRM files in the /usr/var/db/mysql/ directory, but I get this - mysql use bulletins Can't read dir of './bulletins/' (Errcode: 13) Database changed - 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
Search results are differant on console and in webmin
I sometimes access mysql through webmin and sometimes via the console (using telnet from a remote machine). I have a table of users (name,password,login) and when I view it on the console I see a few fields appear to be missing a few characters. When I view it via webmin those same fields show all their characters. Any idea what the problem could be? (Or is it actually a problem?) Chip Wiegand Computer Services www.simradusa.com [EMAIL PROTECTED] Simrad, Inc Lynnwood, WA 425-712-1138 There is no reason anyone would want a computer in their home. --Ken Olson, president, chairman and founder of Digital Equipment Corp., 1977 (-- Then why do I have nine? Somebody help me!) - 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
Import data question
I have a table I want to import some records into. The table has 4 columns - user_id, name, account, password. The file I have to be imported has 3 columns - password,name,account. I have been trying to use load data infile and keep ending up with a lot of junk in the database. The file is of this format - password,name,account password,name,account etc File name is users and table name is users. mysql load data infile '/usr/home/chip/users' into table users - (name,password,account) - fields terminated by ','; ERROR 1064: You have an error in your SQL syntax near 'fields terminated by ','' at l ine 3 mysql Regards, Chip Wiegand Computer Services www.simradusa.com [EMAIL PROTECTED] Simrad, Inc Lynnwood, WA 425-712-1138 There is no reason anyone would want a computer in their home. --Ken Olson, president, chairman and founder of Digital Equipment Corp., 1977 (-- Then why do I have nine? Somebody help me!) - 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
Please help - does changing the port the web server listens on affect mysql?
I am having a problem with inserting data into a table via a web form, which was working just fine prior to changing the port the web server is listening on from 80 to 8080. I can insert data via the mysql command line just fine, just not from the web form. Below are the forms and table def for reference. (freebsd4.2, apache 1.3.14, php4.0.3pl1, mysql Ver 11.15 Distrib 3.23.38, for -freebsd4.2 (i386) ) -- Chip This first one is the data input form... -- html head titleDealer Bulletins - Simrad, Inc/title /head body bgcolor=aqua ? if(isset($submit)): $db = mysql_connect(localhost, root); mysql_select_db(todaysnews, $db); $date = date(Y-m-d); $sql = insert into bulletin values (null,'$heading','$body','$bulletin_number','$bulletin_subject','$bulletin_from1','$bulletin_date','$bulletin_from2'); mysql_query($sql); print(h2The Data has been entered!/h2\n); print(strongYou can add another Dealer Bulletin below/strongbr /hr\n); endif; ? table summary= width=90% border=0 cellpadding=5 cellspacing=0 align=center tr td colspan=2 h2centerDealer Bulletins - Simrad, Inc/center/h2br / hr align=center noshade=noshade width=50% /br / h3Enter your Dealer Bulletin into the database/h3 All fields can be changed if this will not be a Dealer Bulletin, otherwise, change only where indicated.br / These fields match the header fields on the printed Dealer Bulletin. form action=bulletin_sorter.php method=post /td /tr tr td valign=bottom Heading:br / font size=-1(Change only if necessary)/fontbr / input type = text name=heading value=Dealer Bulletin - maxlength=48 /td td valign=bottom Bulletin Number:br / font size=-1(Change only the two center 0's)/fontbr / input type = text name=bulletin_number value=DB-00-01 maxlength=48 /tr tr td colspan=2 valign=bottom Bulletin Subject:br / font size=-1If the subject is longer than 60 characters you can force it to wrap with the following tag:br /lt;br /gt; The br stands for break, so this will force a line break. Just type in that tag wherever you want the line to break./fontbr / input type = text name=bulletin_subject maxlength=64 size=60 value=Overwrite this with the subject from printed Bulletin /td /tr tr td colspan=2 valign=bottom Bulletin From 1:br /select name=bulletin_from1 option value=Choose OneChoose One/option option value=Tom Burke, Product Support Mgr - Autopilots InstrumentationTom Burke, Product Support Mgr - Autopilots Instrumentation/option option value=Brian Vlad, Product Support Mgr - Plotter Radar ProductsBrian vlad, Product Support Mgr - Plotter Radar Products/option option value=Michael Hillers, Fisheries MgrMichael Hillers, Fisheries Mgr/option option value=David Parkinson, National Sales MgrDavid Parkinson, National Sales Mgr/option option value=John Caballero, General ManagerJohn Caballero, General Manager/option option value=Brian Staton, PresidentBrian Staton, President/option option value=Bruce Trimble, Operations ManagerBruce Trimble, Operations Manager/option option value=Phil Roberts, Service ManagerPhil Roberts, Service Manager/option /select /td /tr tr td valign=bottom Bulletin Date:br / font size=-1(Change only the 0's [Mo-Day] )/fontbr / input type=text name=bulletin_date value=00-00-2001 maxlength=15 /td td valign=bottom Bulletin From 2:br /select name=bulletin_from2 option value=Choose OneChoose One/option option value=David Parkinson, National Sales MgrDavid Parkinson, National Sales Mgr/option option value=John Caballero, General ManagerJohn Caballero, General Manager/option /select /td /tr tr td colspan=2Bulletin:br / br / textarea cols=80 rows=20 name=body wrap=virtual/textarea /td /tr tr td colspan=2 input type=submit name=submit value=Submit! input type=reset name=reset value=Start Over! /td /tr /table /form /body /html --- Now the table def - mysql describe bulletin; +--+-+--+-+-++ | Field | Type | Null| Key | Default | |Extra | +--+-+--+-+-++ | news_id | int(11)|| PRI| NULL| |auto_increment | | heading | varchar(48) | YES || NULL| || | body | text | YES | MUL | NULL| | | | bulletin_number | varchar(48) | YES || NULL|| | bulletin_subject | varchar(64) | YES | MUL | NULL|| | bulletin_from1 | varchar(64) | YES || NULL|| | bulletin_date| varchar(15) | YES || NULL|| | bulletin_from2 | varchar(64) | YES | | NULL|| +--+-+--+-+-++ - The bulletin
can't connect from web page, but works fine from command line
I have a web page form that writes to a database and it has been working just fine for a couple weeks now, and all of a sudden it's not working today. The fail to connect message doesn't even come up. ? if(isset($submit)): if (!$db = mysql_connect(localhost,root)): print(h1Can't connect to database/h1\n); else: mysql_select_db(todaysnews, $db); endif; $date = date(Y-m-d); $sql = insert into bulletin values(null,'$heading','$body','$date','$author_name','$author_email','$bulletin_number','$bulletin_subject', '$bulletin_from1','$bulletin_date','$bulletin_from2'); mysql_query($sql); print(h2The Data has been entered!/h2\n); print(strongYou can add another Dealer Bulletin below/strongbr /hr\n); endif; ? I have purposely changed the name todaysnews to be incorrect and the page, on submit, will just continue to the next web page as if all is well and good. I can add data from the mysql command line, and also from within webmin, just not from the web page. Is it a permissions problem, or access rights problem, or something like that? The only change made recently was to the web server, apache, it now listens on port 8080 rather than port 80. This should have no effect on mysql though, right? Chip Wiegand Computer Services www.simradusa.com [EMAIL PROTECTED] Simrad, Inc Lynnwood, WA 425-712-1138 There is no reason anyone would want a computer in their home. --Ken Olson, president, chairman and founder of Digital Equipment Corp., 1977 (-- Then why do I have nine? Somebody help me!) - 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
web search form for a mysql database
I have mysql 3.23.38, php4.03, apache1.3.14. I have a small database of dealer bulletins. I have created a web page to allow easy input of new bulletins into the database, and a second web page to display those bulletins. On this page are links to allow displaying the bulletins in several differant sort orders. This all works just fine. I was asked to also add a search field. I have searched the online docs but cannot find an answer to this: how do I get a user inputted reqest into the mysql query string? Here's what I have tried most recently: (lots of snipped code) form action=bulletin_sorter.php name=form1 Enter a search word(s): input type=text name=body INPUT TYPE=hidden NAME=orderby VALUE=request /form (lots of snippage) elseif ($orderby == 'request'): $sql = select * from bulletin where match (bulletin_subject,body) against '$request'; (lots more snippage) I have tried variations on the above query statement, none of which would work. I can do this without any problem from the mysql command line by entering the word I am interested in searching on. The problem seems to be with the part after against, just how do I get the user input data into that field? Chip Wiegand Computer Services www.simradusa.com [EMAIL PROTECTED] Simrad, Inc Lynnwood, WA 425-712-1138 There is no reason anyone would want a computer in their home. --Ken Olson, president, chairman and founder of Digital Equipment Corp., 1977 (-- Then why do I have nine? Somebody help me!) - 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: web search form for a mysql database
; } } else { echo Search string is empty. br Go back and type a string to search; } include ('links.x'); ? -Original Message- FROM: [EMAIL PROTECTED] TO: [EMAIL PROTECTED] DATE: Thu 7/5/01 10:13 SUBJECT: web search form for a mysql database I have mysql 3.23.38, php4.03, apache1.3.14. I have a small database of dealer bulletins. I have created a web page to allow easy input of new bulletins into the database, and a second web page to display those bulletins. On this page are links to allow displaying the bulletins in several differant sort orders. This all works just fine. I was asked to also add a search field. I have searched the online docs but cannot find an answer to this: how do I get a user inputted reqest into the mysql query string? Here's what I have tried most recently: (lots of snipped code) form action=bulletin_sorter.php name=form1 Enter a search word(s): input type=text name=body INPUT TYPE=hidden NAME=orderby VALUE=request /form (lots of snippage) elseif ($orderby == 'request'): $sql = select * from bulletin where match (bulletin_subject,body) against '$request'; (lots more snippage) I have tried variations on the above query statement, none of which would work. I can do this without any problem from the mysql command line by entering the word I am interested in searching on. The problem seems to be with the part after against, just how do I get the user input data into that field? Chip Wiegand Computer Services www.simradusa.com [EMAIL PROTECTED] Simrad, Inc Lynnwood, WA 425-712-1138 There is no reason anyone would want a computer in their home. --Ken Olson, president, chairman and founder of Digital Equipment Corp., 1977 (-- Then why do I have nine? Somebody help me!) - 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: web search form for a mysql database
the records with Name LIKE $srch or Last LIKE $srch etc. The translation to MySQL query is: $query = select * from visitors WHERE Name LIKE '$srch' || Last LIKE '$srch' || email LIKE '$srch' || comment LIKE '$srch'; The complete srch.php3 script top to bottom should look like: ? if ($search) // perform search only if a string was entered. { mysql_connect() or die (Problem connecting to DataBase); $srch=%.$search.%; $query = select * from visitors WHERE Name LIKE '$srch' || Last LIKE '$srch' || email LIKE '$srch' || comment LIKE '$srch'; $result = mysql_db_query(guest_book, $query); if ($result) { echo Here are the results:brbr; echo table width=90% align=center border=1tr td align=center bgcolor=#00Visit time and date/td td align=center bgcolor=#00User Name/td td align=center bgcolor=#00Last Name/td td align=center bgcolor=#00Email/td /tr; while ($r = mysql_fetch_array($result)) { // Begin while $ts = $r[TimeStamp]; $name = $r[Name]; $last = $r[Last]; $email = $r[email]; $comment = $r[comment]; echo tr td$ts/td td$name/td td$last/td td$email/td/tr tr td colspan=4 bgcolor=\#a0\$comment/td /tr; } // end while echo /table; } else { echo problems; } } else { echo Search string is empty. br Go back and type a string to search; } include ('links.x'); ? -Original Message- FROM: [EMAIL PROTECTED] TO: [EMAIL PROTECTED] DATE: Thu 7/5/01 10:13 SUBJECT: web search form for a mysql database I have mysql 3.23.38, php4.03, apache1.3.14. I have a small database of dealer bulletins. I have created a web page to allow easy input of new bulletins into the database, and a second web page to display those bulletins. On this page are links to allow displaying the bulletins in several differant sort orders. This all works just fine. I was asked to also add a search field. I have searched the online docs but cannot find an answer to this: how do I get a user inputted reqest into the mysql query string? Here's what I have tried most recently: (lots of snipped code) form action=bulletin_sorter.php name=form1 Enter a search word(s): input type=text name=body INPUT TYPE=hidden NAME=orderby VALUE=request /form (lots of snippage) elseif ($orderby == 'request'): $sql = select * from bulletin where match (bulletin_subject,body) against '$request'; (lots more snippage) I have tried variations on the above query statement, none of which would work. I can do this without any problem from the mysql command line by entering the word I am interested in searching on. The problem seems to be with the part after against, just how do I get the user input data into that field? Chip Wiegand Computer Services www.simradusa.com [EMAIL PROTECTED] Simrad, Inc Lynnwood, WA 425-712-1138 There is no reason anyone would want a computer in their home. --Ken Olson, president, chairman and founder of Digital Equipment Corp., 1977 (-- Then why do I have nine? Somebody help me!) - 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 - 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
using a variable to search a database
I have a database of dealer bulletins. I have a web page that shows the results of sorting the info in the database in certain ways. I also want to add a field to the page to allow the user to input a search word(s) and have the results displayed. I can't find the answer to this in the docs on the mysql site, I tried to search the archive, but it is s slow I gave up on that. So, here's what I have, a few else/elseif's to handle the sorting, plus this line elseif ($orderby == 'request'): $sql = select bulletin_number,bulletin_subject from bulletin where match (body,bulletin_subject) against ('request'); I want 'request' to be the variable from the form input=text field. Does mysql have something similar to perl's $variable=STDIN? Just how do I do this type of search? Thankyou, Chip Wiegand Computer Services www.simradusa.com [EMAIL PROTECTED] Simrad, Inc Lynnwood, WA 425-712-1138 There is no reason anyone would want a computer in their home. --Ken Olson, president, chairman and founder of Digital Equipment Corp., 1977 (-- Then why do I have nine? Somebody help me!) - 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