Re: Changing auto_increment field in mysql to start at 1000
How about updating all the fields instead of one? UPDATE customers SET row_id=row_id+1000; Regards, Sebastiaan J.A. Kamp VOF Post Zero Hoogstraat 98a 3011PT Rotterdam The Netherlands - Original Message - From: Armando Cerna [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, August 29, 2001 11:09 PM Subject: Changing auto_increment field in mysql to start at 1000 I tried this: update customers set row_id='1000' where row_id='1'; but that only changed the one field in the table and the other ones stayed the same =(. Could someone please tell me the correct way to do this Armando - 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: Embedding MySQL in an application
Documentation for any programming language that supports / has an interface to / uses MySQL. Try PHP (www.php.net), Perl (http://www-cgi.cs.cmu.edu/cgi-bin/perl-man), or one of the many others. Regards, Sebastiaan J.A. Kamp - Original Message - From: Shawn P. Garbett [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, August 09, 2001 3:43 PM Subject: Embedding MySQL in an application I have been told it is possible to embed MySQL in an application such that the user never knows a database is running underneath the app. Where can I find more information about doing this? -- Shawn P. Garbett [EMAIL PROTECTED] See http://www.garbett.org/public-key for my PGP key - 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: SQL Error?
--- Reply is under the quoted text --- =From: Michael T. Babcock [mailto:[EMAIL PROTECTED]] =Subject: SQL Error? = =I have a table that contains hourly work done on projects. It has =a basic structure of (extraneous fields left out): = =++--+--+ =| Field | Type | Null | =++--+--+ =| ID | int(10) unsigned | | =| ProjectID | bigint(20) | | =| ContactID | int(10) unsigned | YES | =| NotesID| int(10) unsigned | YES | =| Start_Time | datetime | | =| End_Time | datetime | YES | =++--+--+ = =I had made 4 entries for a day that had the wrong date; =eg 2001-07-01 9:00 instead of 2001-08-01 9:00. = =I did a seconds count between the incorrect times and the =correct times (2592000) and then ran: = =UPDATE ProjectTime set Start_Time=UNIX_TIMESTAMP(Start_Time)+2592000; = =This gave me warnings and thats when I realised that I hadn't =put a WHERE clause in, so I ran the same query in reverse (-2592000). = =Now all of my entries (in the entire table) have '0' for their =Start_Time. = =1) Is there any way (besides a restore from a 24hr old =backup tape) to get the old values back? =2) Why did these queries fail to do what I'd expected? Michael, As far as I know, there'll be no other solution than recovering from backup. However, there's another Caveat here! It seems to me to problems arise in your first query: UNIX_TIMESTAMP(Start_Time)=2592000 will result in a large number, i.e.: +---+ | UNIX_TIMESTAMP(NOW())+2592000 | +---+ | 999888107 | +---+ If you insert this value into a datetime column, as you've done, you're inserting an incompatible value: +++ | id | changed| +++ | 10 | 2912112238 | +++ 1 row in set (0.00 sec) mysql update link set changed='999888107' where value=36000; Query OK, 1 rows affected (0.01 sec) Rows matched: 1 Changed: 1 Warnings: 1 mysql select * from link; +++ | id | changed| +++ | 10 | 00 | +++ Seems to me you'd have to convert your unixtime back to a timestamp before inserting it: UPDATE ProjectTime set Start_Time=FROM_UNIXTIME(UNIX_TIMESTAMP(Start_Time)+2592000); This should help you avoiding all zero values as a result next time. Regards, Sebastiaan J.A. Kamp General Manager VOF Post Zero Hoogstraat 98a 3011 PT Rotterdam tel. +31 1 04199140 fax. +31 1 04111335 @to: [EMAIL PROTECTED] Information Automation Erasmus University Rotterdam Network system manager, Lector New Media Room L5-040, Woudestein Burgemeester Oudlaan 50 3062 PA Rotterdam tel. 010-4088638 @to: [EMAIL PROTECTED] Executive Officer Safenet BV van Galenstraat 35 2518 EN Den Haag tel. 070-3642968 fax. 070-3454537 @to: [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: Backup of all Databases
Lectori Salutem, as Stefan states here (und natürlich ganz richtig, Stefan) mysqldump is *the* way to backup, and it will create large files. However, since you get clear-text human readable text in the outfile -being all the mySQL commands needed to recreate the database(s)- they're easy to compress with a pretty good ratio. Under linux, it's as easy as: mysqldump --all-databases | gzip -c my_dump_archive.sql.gz To get the SQL-commands back, unzip the archive: gzip -d my_dump_archive.sql.gz To restore the databases, run the console output of gzip through mysql: gzip -cd | mysql -u root -pmypassword Of course, most of this could have been found in the list-archives on http://lists.mysql.com Regards, Sebastiaan J.A. Kamp General Manager VOF Post Zero Hoogstraat 98a 3011 PT Rotterdam tel. +31 1 04199140 fax. +31 1 04111335 @to: [EMAIL PROTECTED] Erasmus University Rotterdam L Information Automation Room L5-040, Woudestein Burgemeester Oudlaan 50 3062 PA Rotterdam tel. 010-4088638 @to: [EMAIL PROTECTED] Executive Officer Safenet BV van Galenstraat 35 2518 EN Den Haag tel. 070-3642968 fax. 070-3454537 @to: [EMAIL PROTECTED] =-Original Message- =From: Stefan Hinz [mailto:[EMAIL PROTECTED]] =Sent: maandag 30 juli 2001 20:51 =To: [EMAIL PROTECTED]; [EMAIL PROTECTED] =Subject: Re: Backup of all Databases = = =Dear Claudemir, = =you can use = =mysqldump --all-databases my_dump_file.sql = =which will make restore possible on *any* operating system. It creates =quite a big file (because of all the create / insert statements) - which =might be slow to transfer to / from an internet machine. It's a bit =faster if you use = =cp /var/lib/mysql/* -R /some/safe/place = =In this case, make sure you use MyISAM files as this table type is =interchangeable and runs on any operating system. = =Regards, = =-- = Stefan Hinz = Geschäftsführer / CEO iConnect e-commerce solutions GmbH = # www.js-webShop.com www.iConnect.de = # Gustav-Meyer-Allee 25, 13355 Berlin = # Tel: +49-30-46307-382 Fax: +49-30-46307-388 - 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: RE: spam
From other mailings on the list and my own experience, it seems [EMAIL PROTECTED] is (has been?) sending these out to any poster to the list. If things aren't fixed yet, I'll probably have another one in a couple of minutes... Anyhow, no SJS, it seems to me this 'no spam' crap has nothing to do with you, or the mail you've been sending to the mysql (*passing the filter here*) list. Regards, Sebastiaan J.A. Kamp =-Original Message- =From: sjs [mailto:[EMAIL PROTECTED]] =Sent: zaterdag 28 juli 2001 23:22 =To: [EMAIL PROTECTED] =Subject: spam = = =I am new to the list, and have only asked two questions. =However, when I post I seem to get a message back from =[EMAIL PROTECTED] about not wanting me to spam. Am I doing =something wrong here? Does anyone else get this message as well? =Thanks, =SJS - 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: timestamp problem
Kory, Since your fieldtype for TheDate is timestamp(14), you don't need a function to insert a timestamp there. In fact, what you're doing now is inserting the text TIMESTAMP into a date field, which results in '' Instead of 'TIMESTAMP', use NULL -- and don't put quotation marks around it!! By inserting 'nothing' into your TheDate field, MySQL is allowed to update the timestamp. Regards, Sebastiaan J.A. Kamp - Original Message - From: Kory Wheatley [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, July 27, 2001 1:17 AM Subject: timestamp problem I'm using PHP to add records into a mysql database. The records write successfully to the database except for the timestamp field which I have defined as Field Type Null Key Default Extra TheDatetimestamp(14) YES NULL Everytime I write a record or edit a record it puts 000 in the TheDate, which of course is not the correct date. Here is the insert command below that I'm using, does anyone have a solution. $query3 = INSERT INTO Quser VALUES('', '$fullname', '$add_novell', '$tot_novell', '$add_cwis', '$tot_cwis', '$add_mail', '$tot_mail', 'TIMESTAMP'); mysql_query($query3); is the TIMESTAMP option where I get the current date from. -- # Kory Wheatley Academic Computing Analyst Sr. Phone 282-3874 # Everything must point to him. - 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-##L=##[EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
RE: Question,
Jason, Hope this will help you get what you want. Of course you need at least one more loop (calculating the number of 'display' actions from sth-numrows()) to repeat the display process for rows 5-10, 11-15, etc. #!/usr/bin/perl use DBD::mysql; #connect to database $dbh = DBI-connect(DBI:mysql:lablog:$dbhost,$dbuser,$dbpass) || die No database connection; #do your query $sth=$dbh-prepare(SELECT * FROM table WHERE something='wanted'); $sth-execute(); #display 5 rows containing 3 columns, for (i=0; i=4; i++) { ($column1, $col2, $col3)=($sth-fetchrow()); print Result: $column1, $col2, $col3\n; } Regards, Sebastiaan J.A. Kamp -Original Message- From: Jason Whitlow [mailto:[EMAIL PROTECTED]] Sent: maandag 9 juli 2001 0:21 To: '[EMAIL PROTECTED]' Subject: Question, I am trying to get on of my apps to display only 5 records at a time. With Perl attaching to a mysql database. Does anyone have any good Ideas of how to do this. Is there a way of doing a select and out of the results saying only give me 5-10 or 10-15? Any help would be greatly appreciated Thank you Jason - 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: Insert queries add TWO records to database
It's more of a PHP than a MySQL 'problem' certainly not a MySQL bug, but... Upon processing $res_insert_campaign=mysql_query($sql,$conn); the script will insert a line into your database. Then, upon evaluating if (!$res_insert_campaign) { it will do if (!mysql_query($sql,$conn)) and insert another line... Try being less 'indirect' about what you want: $sql = INSERT INTO Campaign (CampaignName,CampaignDesc,StartDate,EndDate,CompanyId,CampaignStatus,AdministratorId) VALUES ('$name','$desc','$start_date','$end_date',$company_id,0,1); if (!mysql_query($sql,$conn);) { return false; } Regards, Sebastiaan J.A. Kamp Operating system: WinNT4 PHP version: 4.0.6 PHP Bug Type: MySQL related Bug description: Insert queries add TWO records to database All my insert queries seem to add two records to the database instead of one. I was using MS Access 2000 and did not have the problem. I am now using MySQL and all insert queries add 2 recs?! [...CUT...] A guy in the US seems to be having the same problem with Sybase. His details are: Rob Donat Sedonatech, Inc. 1735 W. Diversey Suite 521 Chicago, IL 60614 [EMAIL PROTECTED] 312-501-1200 cell 773-388-0271(2) office(fax)
Re: How to make symbolic link under windows
Unfortunately, symbolic links are a Unix / Linux feature, not Windows. Regards, Sebastiaan J.A. Kamp Dear all, Did anyone now how to make symbolic link for mysql data directory under Windows NT 4.0. Mysql data directory sits on C:\mysql\data\ecom and I would like to transfer it to D:\ecom. My Mysql version is 3.23.32, installed using the '.exe' file. I would like to know if this is possible? If so, how? Thank you in advance. Emanduel Chan Tain Por System Engineer DotCom Consulting Sdn Bhd DID : 603-62763230 ext. 112 - 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: linking columns
Daniel, This would be a 'contre-coeur' to any database... If you want some output like this, make it so in your query: SELECT *, (column_1 * column_2) AS column_3 FROM table; If you actually want to store the result of the calculation, do it in your insert query; However, a 'dynamic value' database content is bogus... Regards, Sebastiaan J.A. Kamp - Original Message - From: Daniel Leal [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, July 01, 2001 12:13 PM Subject: linking columns Hi everyone! I'm starting with mysql! I wish to know if it is possible to make a table that has to columns linked by a mathematic expression. For example: My table is my_tbl; And it has three colums: column_1, column_2 and column_3; Every column have int or float values; And for example, I want that the third column always be equal to column_1 * column_2; So when I change a value in column_1 or column_2, then column_3 will be change imediatly by mysql! Is that possible? how can I do it? Thanks... Daniel - 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: Date format problem
What programming language are you using? Hi guys, does anyone help me with this simple thing ?? I have a date format problem, I need a spanish format please read the following lines: Receive from input 28/06/2001 Want to change it to 2001-06-28 to write the Database Use to do it DATE_FORMAT (inputdate, %Y-%m-%d) It doesn't work fine Thanks a lot for your time - 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: Full text search gotchas
mysql select * from test; +---+---+ | a | b | +---+---+ | 1 | The children are playing on the play-ground | | 2 | And some other sentence too | | 3 | Just for testing purposes | | 4 | Even though I do not like children, I will mention them once more | +---+---+ mysql select * from test where b LIKE '%child%'; +---+---+ | a | b | +---+---+ | 1 | The children are playing on the play-ground | | 4 | Even though I do not like children, I will mention them once more | +---+---+ The search can *NOT* be done on a 'fulltext' index, though... From: Nessi [EMAIL PROTECTED] To: Sebastiaan J.A. Kamp [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Tuesday, June 26, 2001 2:31 PM Subject: Re: Full text search gotchas Hello, thanks for your reply. I was wondering...I thought the LIKE function is only for single words? I have to admit I never tested it and started right off with fulltext option. So would following work then... Lets assume one entry in somefield is: The children are playing on the play-ground and I want to search for it using LIKE: SELECT * FROM yourtable WHERE somefield LIKE '%child%'; Would that then give me above entry in the output?!?
Re: DBI-connect
Looks like a perl script, so you can use 'or' (||) to evaluate your 'connect' string, i.e. To stop the script if connect fails use $dbh = DBI-connect(dbi:mysql:database:localhost,'user','password') || die No connection to database; To issue a warning only $dbh = DBI-connect(dbi:mysql:database:localhost,'user','password') || print Database connect failed; Regards, Sebastiaan J.A. Kamp - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Tuesday, June 26, 2001 1:34 PM Subject: DBI-connect how can I test DBI-connect ? I'm geting this error: Software error: Execution of /var/www/cgi-bin/mySQL.pl aborted due to compilation errors. Yann carlier +351-21-4527104/5 www.inteliware.net [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
Fuzzy results from NOW()-... in select statement?
As I tried to find out how many entries are written to a 'log' table in the past 10, 5, 2 and 1 minute(s), I got some odd results. Since I haven't been able to find any reason (NOW()-60) should result in something completely different from (NOW()-120), could somebody clarify what's going on here? 'changed' is a TIMESTAMP(14) field... mysql SELECT COUNT(*) FROM web WHERE changed = (NOW()-60); +--+ | COUNT(*) | +--+ | 363564 | +--+ 1 row in set (7.00 sec) mysql SELECT COUNT(*) FROM web WHERE changed = (NOW()-120); +--+ | COUNT(*) | +--+ | 38 | +--+ 1 row in set (8.27 sec) mysql SELECT COUNT(*) FROM web WHERE changed = NOW()-120; +--+ | COUNT(*) | +--+ | 37 | +--+ 1 row in set (6.40 sec) mysql SELECT COUNT(*) FROM web WHERE changed = NOW()-60; +--+ | COUNT(*) | +--+ | 364119 | +--+ 1 row in set (7.46 sec) Hope someone can shed some light for me ;-) K.R., Sebastiaan Kamp
Re: make install
Seems your installing on a Linux / Unix system... In te directory where your mySQL setup (such as mysql_install_db) is, run make install ... just type it at the command line. F.Y.I.: read 'man make' I am trying to set up a server. When I try to run the file mysql_install_db I get the error message You need to do a 'make install' before exectuing the script. Does anyone know what I should do? Please help. 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