RE: Insert data in one table from Another Problem
Here's one option to pivot your results: select record_id ,max(soi) as soi ,max(heading) as heading ,max(description) as description ,max(relloc) as relloc from (select record_id ,if(field_name = 'SOI', field_value, '') as soi ,if(field_name = 'Heading', field_value, '') as heading ,if(field_name = 'Description', field_value, '') as description ,if(field_name = 'RelLoc', field_value, '') as relloc from user_news) s1 group by s1.record_id; -Original Message- From: Adarsh Sharma [mailto:adarsh.sha...@orkash.com] Sent: Wednesday, February 16, 2011 6:33 AM To: mysql@lists.mysql.com Subject: Insert data in one table from Another Problem Dear all, Today I am puzzled around a problem of inserting data into new table in new format. I have a table named *user_news* as : We have four rows with respect to each record_id. fore.g : I have listed main columns as *record_id field_name field_value* 572SOIMedia 572 Heading A senior Police official confirmed the presence of the stone quarry at Jafflong near the India-Bangladesh border 572Description HNLC runs a stone quarry in Jafflong District of Bangladesh. The outfit is also believed to own several betel nut plantations besides running other business in Bangladesh. 572 RelLoc Jafflong 578SOI Media 578 Heading Army Chief General V. K. Singh in Shillong said he was confident that the NDFB would come to the negotiating table if they are handled properly 578Description A school teacher was abducted by unidentified militants in Damas of East Garo Hills District. Army Chief General V. K. Singh in Shillong said he was confident . 578 RelLoc Garo Hills Similarly i have 1000 of rows. Now I create a new table as columns as : *record_id SOI heading Description RelLoc * and its values is as : * * 572 MediaA senior Police official confirmed the presence of the stone quarry at Jafflong near the India-Bangladesh border HNLC runs a stone quarry in Jafflong District of Bangladesh. Jafflong The values in *field_name* becomes four columns in the above table . and their values are the values of f*ield_value *column. The problem is that I want this data now in horizontal form and the data of four rows in one row. That is four rows in one table contributes a single row in *other *table. I try with procedures and cursors but fail to achieve the output. Is it possible in Mysql. Please guide me how to achieve this as I am stuck around it. Thanks Best Regards Adarsh Sharma -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org
Insert data in one table from Another Problem
Dear all, Today I am puzzled around a problem of inserting data into new table in new format. I have a table named *user_news* as : We have four rows with respect to each record_id. fore.g : I have listed main columns as *record_id field_name field_value* 572SOIMedia 572 Heading A senior Police official confirmed the presence of the stone quarry at Jafflong near the India-Bangladesh border 572Description HNLC runs a stone quarry in Jafflong District of Bangladesh. The outfit is also believed to own several betel nut plantations besides running other business in Bangladesh. 572 RelLoc Jafflong 578SOI Media 578 Heading Army Chief General V. K. Singh in Shillong said he was confident that the NDFB would come to the negotiating table if they are handled properly 578Description A school teacher was abducted by unidentified militants in Damas of East Garo Hills District. Army Chief General V. K. Singh in Shillong said he was confident . 578 RelLoc Garo Hills Similarly i have 1000 of rows. Now I create a new table as columns as : *record_id SOI heading Description RelLoc * and its values is as : * * 572 MediaA senior Police official confirmed the presence of the stone quarry at Jafflong near the India-Bangladesh border HNLC runs a stone quarry in Jafflong District of Bangladesh. Jafflong The values in *field_name* becomes four columns in the above table . and their values are the values of f*ield_value *column. The problem is that I want this data now in horizontal form and the data of four rows in one row. That is four rows in one table contributes a single row in *other *table. I try with procedures and cursors but fail to achieve the output. Is it possible in Mysql. Please guide me how to achieve this as I am stuck around it. Thanks Best Regards Adarsh Sharma
Re: INSERT DATA INTO TABLE
At 12:09 AM 11/28/2009, Krishna Chandra Prajapati wrote: Hi Mos, In the below two command does 1 is faster than 2. 1. LOAD DATA LOCAL INFILE '/path/pet.txt' INTO TABLE pet; 2. LOAD DATA LOCAL INFILE '/path/pet.txt' INTO TABLE pet LINES TERMINATED BY '\r\n' enclosed by ''; Thanks, Krishna Ch. Prajapati Krishna, They are the same speed. #2 only gives additional information on how the CSV file is formatted. The Load Data, in case you weren't already aware, imports comma delimited data from a text file into a MySQL table. The LINES TERMINATED BY '\r\n' enclosed by ' ' only tells MySQL how the data is formatted. Before we delve into this any further, how many rows of data are you loading? And what table type: MyISAM or InnoDb? Mike On Sat, Nov 28, 2009 at 3:50 AM, mos mailto:mo...@fastmail.fmmo...@fastmail.fm wrote: At 07:40 AM 11/27/2009, Krishna Chandra Prajapati wrote: Hi Experts, load data local infile and insert into tablename are the two methods of inserting data into a mysql table. Out of the above two method. Is there any faster method of inserting data into mysql tables. No. Load Data is the fastest method, unless the data is already stored in another table. Tip: Remember when using Load Data, it will be faster if the table is empty and optimized (no holes) than with a table that has data in it. That's because the non-unique indexes are built after all of the data has been loaded. The alternative is to disable the non-unique indexes prior to using Load Data. Unfortunately there is no way to disable the building of unique indexes during this process unless you remove the unique index prior to loading the data and building it later. Tip: Using Insert will be much slower than Load Data but you can speed it up by loading dozens of rows using one Insert statement. Hope these tips help. Mike -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysqlhttp://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/mysql?unsub=prajapat...@gmail.comhttp://lists.mysql.com/mysql?unsub=prajapat...@gmail.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org
INSERT DATA INTO TABLE
Hi Experts, load data local infile and insert into tablename are the two methods of inserting data into a mysql table. Out of the above two method. Is there any faster method of inserting data into mysql tables. Thanks, Krishna Ch. Prajapati
Re: INSERT DATA INTO TABLE
At 07:40 AM 11/27/2009, Krishna Chandra Prajapati wrote: Hi Experts, load data local infile and insert into tablename are the two methods of inserting data into a mysql table. Out of the above two method. Is there any faster method of inserting data into mysql tables. No. Load Data is the fastest method, unless the data is already stored in another table. Tip: Remember when using Load Data, it will be faster if the table is empty and optimized (no holes) than with a table that has data in it. That's because the non-unique indexes are built after all of the data has been loaded. The alternative is to disable the non-unique indexes prior to using Load Data. Unfortunately there is no way to disable the building of unique indexes during this process unless you remove the unique index prior to loading the data and building it later. Tip: Using Insert will be much slower than Load Data but you can speed it up by loading dozens of rows using one Insert statement. Hope these tips help. Mike -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org
Re: INSERT DATA INTO TABLE
Hi Mos, In the below two command does 1 is faster than 2. * 1. LOAD DATA LOCAL INFILE '/path/pet.txt' INTO TABLE pet;* 2. *LOAD DATA LOCAL INFILE '/path/pet.txt' INTO TABLE pet* *LINES TERMINATED BY '\r\n' enclosed by '';* Thanks, Krishna Ch. Prajapati On Sat, Nov 28, 2009 at 3:50 AM, mos mo...@fastmail.fm wrote: At 07:40 AM 11/27/2009, Krishna Chandra Prajapati wrote: Hi Experts, load data local infile and insert into tablename are the two methods of inserting data into a mysql table. Out of the above two method. Is there any faster method of inserting data into mysql tables. No. Load Data is the fastest method, unless the data is already stored in another table. Tip: Remember when using Load Data, it will be faster if the table is empty and optimized (no holes) than with a table that has data in it. That's because the non-unique indexes are built after all of the data has been loaded. The alternative is to disable the non-unique indexes prior to using Load Data. Unfortunately there is no way to disable the building of unique indexes during this process unless you remove the unique index prior to loading the data and building it later. Tip: Using Insert will be much slower than Load Data but you can speed it up by loading dozens of rows using one Insert statement. Hope these tips help. Mike -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/mysql?unsub=prajapat...@gmail.com
query and insert data on multiple tables
I am trying to create a php-mysql page to POST new records to several tables from one php page and I have to retrieve records from several (like 4 to 8) tables in one query. Being quite new to php mysql, I am wondering what is the best way to go about this. My tables consist of * Structure http://biggie/phpmyadmin/tbl_structure.php?db=biblanetoken=6b20581bf9be2fb146f60d93cc87a296table=authorsgoto=tbl_structure.php authors http://biggie/phpmyadmin/sql.php?db=biblanetoken=6b20581bf9be2fb146f60d93cc87a296table=authorspos=0 * Structure http://biggie/phpmyadmin/tbl_structure.php?db=biblanetoken=6b20581bf9be2fb146f60d93cc87a296table=booksgoto=tbl_structure.php books http://biggie/phpmyadmin/sql.php?db=biblanetoken=6b20581bf9be2fb146f60d93cc87a296table=bookspos=0 * Structure http://biggie/phpmyadmin/tbl_structure.php?db=biblanetoken=6b20581bf9be2fb146f60d93cc87a296table=book_authorgoto=tbl_structure.php book_author http://biggie/phpmyadmin/sql.php?db=biblanetoken=6b20581bf9be2fb146f60d93cc87a296table=book_authorpos=0 * Structure http://biggie/phpmyadmin/tbl_structure.php?db=biblanetoken=6b20581bf9be2fb146f60d93cc87a296table=book_categoriesgoto=tbl_structure.php book_categories http://biggie/phpmyadmin/sql.php?db=biblanetoken=6b20581bf9be2fb146f60d93cc87a296table=book_categoriespos=0 * Structure http://biggie/phpmyadmin/tbl_structure.php?db=biblanetoken=6b20581bf9be2fb146f60d93cc87a296table=book_publishergoto=tbl_structure.php book_publisher http://biggie/phpmyadmin/sql.php?db=biblanetoken=6b20581bf9be2fb146f60d93cc87a296table=book_publisherpos=0 * Structure http://biggie/phpmyadmin/tbl_structure.php?db=biblanetoken=6b20581bf9be2fb146f60d93cc87a296table=book_sellersgoto=tbl_structure.php book_sellers http://biggie/phpmyadmin/sql.php?db=biblanetoken=6b20581bf9be2fb146f60d93cc87a296table=book_sellerspos=0 * Structure http://biggie/phpmyadmin/tbl_structure.php?db=biblanetoken=6b20581bf9be2fb146f60d93cc87a296table=categoriesgoto=tbl_structure.php categories http://biggie/phpmyadmin/sql.php?db=biblanetoken=6b20581bf9be2fb146f60d93cc87a296table=categoriespos=0 * Structure http://biggie/phpmyadmin/tbl_structure.php?db=biblanetoken=6b20581bf9be2fb146f60d93cc87a296table=languagegoto=tbl_structure.php language http://biggie/phpmyadmin/sql.php?db=biblanetoken=6b20581bf9be2fb146f60d93cc87a296table=languagepos=0 * Structure http://biggie/phpmyadmin/tbl_structure.php?db=biblanetoken=6b20581bf9be2fb146f60d93cc87a296table=publishersgoto=tbl_structure.php publishers http://biggie/phpmyadmin/sql.php?db=biblanetoken=6b20581bf9be2fb146f60d93cc87a296table=publisherspos=0 * Structure http://biggie/phpmyadmin/tbl_structure.php?db=biblanetoken=6b20581bf9be2fb146f60d93cc87a296table=sellersgoto=tbl_structure.php sellers http://biggie/phpmyadmin/sql.php?db=biblanetoken=6b20581bf9be2fb146f60d93cc87a296table=sellerspos=0 On top of this, I have a problem of how to deal with multiple authors for a number of books... formatting a page with several authors is not a prolem... but how do I POST and SELECT several authors for the same book? Categories is a similar problem... And then, there is the question of language - books are included from 5 different languages... This, I thought, could be handled by referencing the language table by the PK of the language table which is obviously numbers from 1 to 5 I am beginning to see the light... but I sure would like to shorten my learning curve by asking here... I would like to see examples, if possible. I have no problem formatting and outputting a great page from a simple SELECT * FROM my_table... but when it comes to querying several tables plus needing to do something like left joins, I am a little lost. How to do a multi-table query or how does one do several queries from one php page? How can multiple POSTs be done on one php page? TIA -- Phil Jourdan --- p...@ptahhotep.com http://www.ptahhotep.com http://www.chiccantine.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org
Re: query and insert data on multiple tables
Hi, On Fri, Feb 13, 2009 at 4:52 PM, PJ af.gour...@videotron.ca wrote: I am trying to create a php-mysql page to POST new records to several tables from one php page and I have to retrieve records from several (like 4 to 8) tables in one query. Being quite new to php mysql, I am wondering what is the best way to go about this. My tables consist of * Structure http://biggie/phpmyadmin/tbl_structure.php?db=biblanetoken=6b20581bf9be2fb146f60d93cc87a296table=authors; Your links don't work for me, and I suspect anyone else on this list. And it may be asking too much of people to click through 40 or so links -- you probably need to ask your question more succinctly to get the best chance of an answer. On top of this, I have a problem of how to deal with multiple authors for a number of books... formatting a page with several authors is not a prolem... but how do I POST and SELECT several authors for the same book? Categories is a similar problem... And then, there is the question of language - books are included from 5 different languages... This, I thought, could be handled by referencing the language table by the PK of the language table which is obviously numbers from 1 to 5 I am beginning to see the light... but I sure would like to shorten my learning curve by asking here... I would like to see examples, if possible. I have no problem formatting and outputting a great page from a simple SELECT * FROM my_table... but when it comes to querying several tables plus needing to do something like left joins, I am a little lost. How to do a multi-table query or how does one do several queries from one php page? How can multiple POSTs be done on one php page? TIA -- Baron Schwartz, Director of Consulting, Percona Inc. Our Blog: http://www.mysqlperformanceblog.com/ Our Services: http://www.percona.com/services.html -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org
insert data in to columns base on the selection of the list box.
Can you help me please? 1-I have created a while loop to populate the list box with the information of column1. 2-I need to update (insert data) in to column2, column3, column4 base on the selection of the list box. echo'form'; $query = SELECT column1 FROM table; $result = mysql_query($query); echobr; echobr; echocenter; echoselect NAME='R'; echooption value='NULL'Choose a Category:/option ; while ($line = mysql_fetch_array($result)) { foreach ($line as $value) { echoOPTION value='$value'; } echo $value/OPTION; } echo /select; echo /form; $sql=INSERT INTO table WHERE column1='.$_POST[R].' (column2, column3, column4)VALUES('info2', 'info3', 'info4'); $result=mysql_query($sql); - No need to miss a message. Get email on-the-go with Yahoo! Mail for Mobile. Get started.
RE: insert data in to columns base on the selection of the list box.
Without knowing where the values of column2, column3, and column4 are coming from it's a little hard to say what the best technique would be. Usually one would take the POSTed value from the select control and use it to retrieve the related data from a table in your data base. Regards, Jerry Schwartz Global Information Incorporated 195 Farmington Ave. Farmington, CT 06032 860.674.8796 / FAX: 860.674.8341 -Original Message- From: sam rumaizan [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 03, 2007 6:51 AM To: mysql@lists.mysql.com Subject: insert data in to columns base on the selection of the list box. Can you help me please? 1-I have created a while loop to populate the list box with the information of column1. 2-I need to update (insert data) in to column2, column3, column4 base on the selection of the list box. echo'form'; $query = SELECT column1 FROM table; $result = mysql_query($query); echobr; echobr; echocenter; echoselect NAME='R'; echooption value='NULL'Choose a Category:/option ; while ($line = mysql_fetch_array($result)) { foreach ($line as $value) { echoOPTION value='$value'; } echo $value/OPTION; } echo /select; echo /form; $sql=INSERT INTO table WHERE column1='.$_POST[R].' (column2, column3, column4)VALUES('info2', 'info3', 'info4'); $result=mysql_query($sql); - No need to miss a message. Get email on-the-go with Yahoo! Mail for Mobile. Get started. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: insert data in to columns base on the selection of the list box.
Can you tell us what exactly is your problem ? ie returned error, logic, or what ? My first impression es that your insert is wrong, because inserts cant have where conditions (it makes no sense) probably you want to do a completely new insert including the column1 or maybe you want an update. Anywhere you can check the manual for sintax issues. Carlos sam rumaizan wrote: Can you help me please? 1-I have created a while loop to populate the list box with the information of column1. 2-I need to update (insert data) in to column2, column3, column4 base on the selection of the list box. echo'form'; $query = SELECT column1 FROM table; $result = mysql_query($query); echobr; echobr; echocenter; echoselect NAME='R'; echooption value='NULL'Choose a Category:/option ; while ($line = mysql_fetch_array($result)) { foreach ($line as $value) { echoOPTION value='$value'; } echo $value/OPTION; } echo /select; echo /form; $sql=INSERT INTO table WHERE column1='.$_POST[R].' (column2, column3, column4)VALUES('info2', 'info3', 'info4'); $result=mysql_query($sql); - No need to miss a message. Get email on-the-go with Yahoo! Mail for Mobile. Get started. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: insert data
Michael, John, ALL; Thank you! Thanks you! My errors of local_host and if $dbh-err fix it. I am able to insert and select data. Thank you ALL, Jerry -Original Message- From: Michael Stassen [mailto:[EMAIL PROTECTED] Sent: Friday, March 04, 2005 5:41 PM To: John Trammell Cc: mysql@lists.mysql.com; [EMAIL PROTECTED]; Gerald Preston Subject: Re: insert data Right. First, I think the logic is flawed. We should successfully prepare() or die. Period. If the call to prepare() failed ($sth is undef), we should not making dying conditional on yet another value. More to the point, this line is actually the cause of the problem. (Sorry I didn't see it earlier.) You've run into the precedence rules: my $sth = $dbh-prepare( $sql ) or die $dbh-errstr if $dbh-err; is read as (my $sth = $dbh-prepare( $sql ) or die $dbh-errstr) if $dbh-err; That is, it is equivalent to if ($dbh-err) { $sth = $dbh-prepare( $sql ) or die $dbh-errstr; } Since the connect succeeded, $dbh-err is undef, so we never even call prepare! Hence, $sth is undef when we get to execute, and you get the error message. I expect this is what Joe (John Doe) was trying to tell us earlier. The simplest solution would be to drop the if $dbh-err. That is, change to my $sth = $dbh-prepare( $sql ) or die $dbh-errstr; John's suggestion (below) is better still, as it adds helpful detail to the error message when there is one (though I don't see the need to make it a separate line of code). Michael John Trammell wrote: Gerald Preston wrote: [snip] my $sth = $dbh-prepare( $sql ) or die $dbh-errstr if $dbh-err; [snip] Regardless of other problems you may be having, I think you're not doing what you want to do here. How about instead: my $sth = $dbh-prepare($sql); $sth || die Error preparing sth from '$sql': , $dbh-errstr; -- 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: insert data
David, I read them and installed 4.1.10 and I am back to square one: I used the following code: #!/perl use warnings; use strict; use DBI; #use DBD-mysql; my $group_name = beer; my $me = E; my $daily = 03032005; my $item = Bacardi; my $unit = 2; my $qty= 3; my $amount = 6; my $tax= 0.41; my $total = 6.41; my $dbh=DBI-connect( 'dbi:mysql:club', 'gjwpp88', 'x' ) or die \n$DBI::errstr\n; my $sql = insert into wolfies( group_name, me, daily, item, unit, qty, amount, tax, total ) values( ?, ?, ?, ?,?,?, ?, ?, ? ) ; my $sth = $dbh-prepare( $sql ) or die $dbh-errstr if $dbh-err; $sth-execute( $group_name, $me, $daily, $item, $unit, $qty, $amount, $tax, $total ) or warn Cannot execute FIRST Statement!!\n$DBI::errstr; I get DBI connect'club','gjwpp88',.. failed; Client does not support authentication protocol requested by server I have done the following with no errors! GRANT ALL PRIVILEGES ON club.* TO 'gjwpp88'@'local_host'; SET PASSWORD FOR 'gjwpp88'@'local_host' = PASSWORD('x'); UPDATE mysql.user SET Password = OLD_PASSWORD('x') WHERE Host = 'local_host' AND User = 'gjwpp88'; SET PASSWORD FOR 'gjwpp88'@'local_host' = OLD_PASSWORD('x'); SELECT 'local_host', 'gjwpp88', Password FROM mysql.user WHERE LENGTH('x') 16; FLUSH PRIVILEGES; I am still getting the same error I listed above. Jerry -Original Message- From: Logan, David (SST - Adelaide) [mailto:[EMAIL PROTECTED] Sent: Monday, February 28, 2005 6:10 PM To: Gerald Preston; mysql@lists.mysql.com Subject: RE: insert data Hi Gerald, There are some good tutorials on the web for DBI access via perl to mysql. http://www.wbluhm.com/MySQLTut.html http://perl.about.com/od/installandusemysql/l/aa090803b.htm http://dev.mysql.com/doc/mysql/en/perl.html and also http://search.cpan.org/~timb/DBI-1.47/DBI.pm You should be able to find several examples of exactly what you are trying to achieve in one of these. The first one has an almost identical query to that you are trying to achieve. If you can't select from the table, then you are unlikely to be able to insert. I would follow the tutorials, even if they are selects, and make sure they work and then all you have to do is to change the SELECT to an INSERT statement and away you go. These have a very thorough examination of the setting up of the dsn etc. I would also suggest http://dev.mysql.com/doc/mysql/en/privilege-system.html This gives a good explanation of how the GRANT/REVOKE/privileges system works with MySQL. It is slightly different than Oracle and would be well worth a read. Regards David Logan Database Administrator HP Managed Services 148 Frome Street, Adelaide 5000 Australia +61 8 8408 4273 - Work +61 417 268 665 - Mobile +61 8 8408 4259 - Fax -Original Message- From: Gerald Preston [mailto:[EMAIL PROTECTED] Sent: Tuesday, 1 March 2005 10:10 AM To: 'William R. Mussatto'; mysql@lists.mysql.com Subject: RE: insert data William, I tried GRANT ALL ON *.* and got error 1064 4200: You have an error in your SQL syntax ?? Jerry -Original Message- From: William R. Mussatto [mailto:[EMAIL PROTECTED] Sent: Monday, February 28, 2005 3:25 PM To: mysql@lists.mysql.com Subject: RE: insert data Gerald Preston said: Michael, This is the actual code except for the : my $dbh = DBI-connect( 'DBI:mysql:database=club', '', '', { PrintError = 0 } ) or die $DBI::errstr; my $sql = insert into wolfies( group_name, me, daily, item, unit, qty, amount, tax, total ) values( ?, ?, ?, ?,?, ?, ?, ?, ? ) ; my $sth = $dbh-prepare( $sql ) or die $dbh-errstr if $dbh-err; $sth-execute( $group_name, $me, $daily, $item, $unit, $qty, $amount, $tax, $total ) or warn Cannot execute FIRST Statement!!\n$DBI::errstr; Question? When I created the database club, is there anything I needed to do concerning permissions or anything? I am lost here. I have been writing code on a SUN Oracle systems for over five years. Regards, Jerry Did you 'grant' user access to all the tables in database club? -Original Message- From: Michael Stassen [mailto:[EMAIL PROTECTED] Sent: Monday, February 28, 2005 9:29 AM To: Gerald Preston Cc: [EMAIL PROTECTED]; mysql@lists.mysql.com Subject: Re: insert data From perldoc DBD::mysql use DBI; $dsn = DBI:mysql:database=$database;host=$hostname;port=$port; $dbh = DBI-connect($dsn, $user, $password); So it's not a syntax problem. Even if it were, we should detect the error long before calling prepare or execute. Perl is quite clearly telling you what is wrong. Originally, you got Can't call method prepare on an undefined value. for the line my $sth = $dbh-prepare( $sql ); which means that $dbh is undefined at the time of the call to prepare
Re: insert data
Gerald Preston wrote: [...] I get DBI connect'club','gjwpp88',.. failed; Client does not support authentication protocol requested by server Check this: URL: http://dev.mysql.com/doc/mysql/en/old-client.html -- Roger -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: insert data
Gerals Preston wrote: [snip] my $sth = $dbh-prepare( $sql ) or die $dbh-errstr if $dbh-err; [snip] Regardless of other problems you may be having, I think you're not doing what you want to do here. How about instead: my $sth = $dbh-prepare($sql); $sth || die Error preparing sth from '$sql': , $dbh-errstr; -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: insert data
Gerald Preston wrote: David, I read them and installed 4.1.10 and I am back to square one: I used the following code: snip my $dbh=DBI-connect( 'dbi:mysql:club', 'gjwpp88', 'x' ) or die \n$DBI::errstr\n; You do not specify the host, so you are connecting to the default, which is localhost. Hence, you must be able to log in as [EMAIL PROTECTED]. snip I have done the following with no errors! GRANT ALL PRIVILEGES ON club.* TO 'gjwpp88'@'local_host'; Here, however, you create the user [EMAIL PROTECTED]. That's not the same thing. You need to use GRANT ALL PRIVILEGES ON club.* TO 'gjwpp88'@'localhost'; See? No underscore. Similarly, you need to drop the underscore (localhost, not local_host) in all of the following. SET PASSWORD FOR 'gjwpp88'@'local_host' = PASSWORD('x'); UPDATE mysql.user SET Password = OLD_PASSWORD('x') WHERE Host = 'local_host' AND User = 'gjwpp88'; SET PASSWORD FOR 'gjwpp88'@'local_host' = OLD_PASSWORD('x'); SELECT 'local_host', 'gjwpp88', Password FROM mysql.user WHERE LENGTH('x') 16; FLUSH PRIVILEGES; I am still getting the same error I listed above. Jerry Michael -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: insert data
Right. First, I think the logic is flawed. We should successfully prepare() or die. Period. If the call to prepare() failed ($sth is undef), we should not making dying conditional on yet another value. More to the point, this line is actually the cause of the problem. (Sorry I didn't see it earlier.) You've run into the precedence rules: my $sth = $dbh-prepare( $sql ) or die $dbh-errstr if $dbh-err; is read as (my $sth = $dbh-prepare( $sql ) or die $dbh-errstr) if $dbh-err; That is, it is equivalent to if ($dbh-err) { $sth = $dbh-prepare( $sql ) or die $dbh-errstr; } Since the connect succeeded, $dbh-err is undef, so we never even call prepare! Hence, $sth is undef when we get to execute, and you get the error message. I expect this is what Joe (John Doe) was trying to tell us earlier. The simplest solution would be to drop the if $dbh-err. That is, change to my $sth = $dbh-prepare( $sql ) or die $dbh-errstr; John's suggestion (below) is better still, as it adds helpful detail to the error message when there is one (though I don't see the need to make it a separate line of code). Michael John Trammell wrote: Gerald Preston wrote: [snip] my $sth = $dbh-prepare( $sql ) or die $dbh-errstr if $dbh-err; [snip] Regardless of other problems you may be having, I think you're not doing what you want to do here. How about instead: my $sth = $dbh-prepare($sql); $sth || die Error preparing sth from '$sql': , $dbh-errstr; -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: insert data
I sent this earlier, but it doesn't seem to have gone through. Apologies to anyone who gets it twice. = From perldoc DBD::mysql use DBI; $dsn = DBI:mysql:database=$database;host=$hostname;port=$port; $dbh = DBI-connect($dsn, $user, $password); So it's not a syntax problem. Even if it were, we should detect the error long before calling prepare or execute. Perl is quite clearly telling you what is wrong. Originally, you got Can't call method prepare on an undefined value. for the line my $sth = $dbh-prepare( $sql ); which means that $dbh is undefined at the time of the call to prepare. Now, you are getting Can't call method execute on an un undefined value for the line $sth-execute( $group_name, $me, $daily, $item, $unit, $qty, $amount, $tax, $total ) or warn Cannot execute FIRST Statement!!\n$DBI::errstr; which means that $sth is undefined at the time of the call to execute. Are you showing us select lines of your code, rather than the actual code? My best guess right now is that you haven't taken into account that my is a scoping operator in perl, and in the lines you haven't showed us, the variables in question ($dbh or $sth) go out of scope. Michael John Doe wrote: Am Sonntag, 27. Februar 2005 22.19 schrieb Gerald Preston: Hi Gerald The object used: my $dbh=DBI-connect( 'DBI:mysql:database=club', 'xxx, 'x', { PrintError = 0} ) or die $DBI::errstr; I didn't see this part in your first post :-) Hmm... I've never seen a '=' in the first argument passed to DBI-connect... Here's an functional example I'm using: my $db ='database'; my $host ='hostname'; my $port ='1234'; $dbh=DBI-connect(DBI:mysql:$db:$host:$port, 'a_username', 'a_password', {RaiseError=1, AutoCommit=1}) or die $0: $DBI::errstr; } So, try using club instead of database=club, and a hostname too. greetings joe [nothing new below] -Original Message- From: John Doe [mailto:[EMAIL PROTECTED] Sent: Sunday, February 27, 2005 6:37 AM To: mysql@lists.mysql.com Subject: Re: insert data Hi Gerald I am trying to insert data for the first time using MySQL. In Oracle I used the following: # my $sql = insert into bar( group_name, me, daily, item, unit, qty, amount, tax, total ) # values( ?, ?, ?, ?,?,?, ?, ?, ? ) ; my $sth = $dbh-prepare( $sql ); die $dbh-errstr if $dbh-err; $sth-execute( $group_name, $me, $daily, $item, $unit, $qty, $amount, $tax, $total ) || die Cannot execute FIRST Statement!!\n$DBI::errstr; I keep getting Can't call method prepare on an un undefined value. All the name listed are correct by looking at MySQLAdmin1.3\4. Apart from David Logan's answer: You have to create the $dbh object first (man DBI); the undefined value in the error message refers to that. HTH joe -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: insert data
From perldoc DBD::mysql use DBI; $dsn = DBI:mysql:database=$database;host=$hostname;port=$port; $dbh = DBI-connect($dsn, $user, $password); So it's not a syntax problem. Even if it were, we should detect the error long before calling prepare or execute. Perl is quite clearly telling you what is wrong. Originally, you got Can't call method prepare on an undefined value. for the line my $sth = $dbh-prepare( $sql ); which means that $dbh is undefined at the time of the call to prepare. Now, you are getting Can't call method execute on an un undefined value for the line $sth-execute( $group_name, $me, $daily, $item, $unit, $qty, $amount, $tax, $total ) or warn Cannot execute FIRST Statement!!\n$DBI::errstr; which means that $sth is undefined at the time of the call to execute. Are you showing us select lines of your code, rather than the actual code? My best guess right now is that you haven't taken into account that my is a scoping operator in perl, and in the lines you haven't showed us, the variables in question ($dbh or $sth) go out of scope. Michael John Doe wrote: Am Sonntag, 27. Februar 2005 22.19 schrieb Gerald Preston: Hi Gerald The object used: my $dbh=DBI-connect( 'DBI:mysql:database=club', 'xxx, 'x', { PrintError = 0} ) or die $DBI::errstr; I didn't see this part in your first post :-) Hmm... I've never seen a '=' in the first argument passed to DBI-connect... Here's an functional example I'm using: my $db ='database'; my $host ='hostname'; my $port ='1234'; $dbh=DBI-connect(DBI:mysql:$db:$host:$port, 'a_username', 'a_password', {RaiseError=1, AutoCommit=1}) or die $0: $DBI::errstr; } So, try using club instead of database=club, and a hostname too. greetings joe [nothing new below] -Original Message- From: John Doe [mailto:[EMAIL PROTECTED] Sent: Sunday, February 27, 2005 6:37 AM To: mysql@lists.mysql.com Subject: Re: insert data Hi Gerald I am trying to insert data for the first time using MySQL. In Oracle I used the following: # my $sql = insert into bar( group_name, me, daily, item, unit, qty, amount, tax, total ) # values( ?, ?, ?, ?,?,?, ?, ?, ? ) ; my $sth = $dbh-prepare( $sql ); die $dbh-errstr if $dbh-err; $sth-execute( $group_name, $me, $daily, $item, $unit, $qty, $amount, $tax, $total ) || die Cannot execute FIRST Statement!!\n$DBI::errstr; I keep getting Can't call method prepare on an un undefined value. All the name listed are correct by looking at MySQLAdmin1.3\4. Apart from David Logan's answer: You have to create the $dbh object first (man DBI); the undefined value in the error message refers to that. HTH joe -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: insert data
Michael, This is the actual code except for the : my $dbh = DBI-connect( 'DBI:mysql:database=club', '', '', { PrintError = 0 } ) or die $DBI::errstr; my $sql = insert into wolfies( group_name, me, daily, item, unit, qty, amount, tax, total ) values( ?, ?, ?, ?,?,?, ?, ?, ? ) ; my $sth = $dbh-prepare( $sql ) or die $dbh-errstr if $dbh-err; $sth-execute( $group_name, $me, $daily, $item, $unit, $qty, $amount, $tax, $total ) or warn Cannot execute FIRST Statement!!\n$DBI::errstr; Question? When I created the database club, is there anything I needed to do concerning permissions or anything? I am lost here. I have been writing code on a SUN Oracle systems for over five years. Regards, Jerry -Original Message- From: Michael Stassen [mailto:[EMAIL PROTECTED] Sent: Monday, February 28, 2005 9:29 AM To: Gerald Preston Cc: [EMAIL PROTECTED]; mysql@lists.mysql.com Subject: Re: insert data From perldoc DBD::mysql use DBI; $dsn = DBI:mysql:database=$database;host=$hostname;port=$port; $dbh = DBI-connect($dsn, $user, $password); So it's not a syntax problem. Even if it were, we should detect the error long before calling prepare or execute. Perl is quite clearly telling you what is wrong. Originally, you got Can't call method prepare on an undefined value. for the line my $sth = $dbh-prepare( $sql ); which means that $dbh is undefined at the time of the call to prepare. Now, you are getting Can't call method execute on an un undefined value for the line $sth-execute( $group_name, $me, $daily, $item, $unit, $qty, $amount, $tax, $total ) or warn Cannot execute FIRST Statement!!\n$DBI::errstr; which means that $sth is undefined at the time of the call to execute. Are you showing us select lines of your code, rather than the actual code? My best guess right now is that you haven't taken into account that my is a scoping operator in perl, and in the lines you haven't showed us, the variables in question ($dbh or $sth) go out of scope. Michael John Doe wrote: Am Sonntag, 27. Februar 2005 22.19 schrieb Gerald Preston: Hi Gerald The object used: my $dbh=DBI-connect( 'DBI:mysql:database=club', 'xxx, 'x', { PrintError = 0} ) or die $DBI::errstr; I didn't see this part in your first post :-) Hmm... I've never seen a '=' in the first argument passed to DBI-connect... Here's an functional example I'm using: my $db ='database'; my $host ='hostname'; my $port ='1234'; $dbh=DBI-connect(DBI:mysql:$db:$host:$port, 'a_username', 'a_password', {RaiseError=1, AutoCommit=1}) or die $0: $DBI::errstr; } So, try using club instead of database=club, and a hostname too. greetings joe [nothing new below] -Original Message- From: John Doe [mailto:[EMAIL PROTECTED] Sent: Sunday, February 27, 2005 6:37 AM To: mysql@lists.mysql.com Subject: Re: insert data Hi Gerald I am trying to insert data for the first time using MySQL. In Oracle I used the following: # my $sql = insert into bar( group_name, me, daily, item, unit, qty, amount, tax, total ) # values( ?, ?, ?, ?,?,?, ?, ?, ? ) ; my $sth = $dbh-prepare( $sql ); die $dbh-errstr if $dbh-err; $sth-execute( $group_name, $me, $daily, $item, $unit, $qty, $amount, $tax, $total ) || die Cannot execute FIRST Statement!!\n$DBI::errstr; I keep getting Can't call method prepare on an un undefined value. All the name listed are correct by looking at MySQLAdmin1.3\4. Apart from David Logan's answer: You have to create the $dbh object first (man DBI); the undefined value in the error message refers to that. HTH joe -- 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: insert data
Gerald Preston said: Michael, This is the actual code except for the : my $dbh = DBI-connect( 'DBI:mysql:database=club', '', '', { PrintError = 0 } ) or die $DBI::errstr; my $sql = insert into wolfies( group_name, me, daily, item, unit, qty, amount, tax, total ) values( ?, ?, ?, ?,?,?, ?, ?, ? ) ; my $sth = $dbh-prepare( $sql ) or die $dbh-errstr if $dbh-err; $sth-execute( $group_name, $me, $daily, $item, $unit, $qty, $amount, $tax, $total ) or warn Cannot execute FIRST Statement!!\n$DBI::errstr; Question? When I created the database club, is there anything I needed to do concerning permissions or anything? I am lost here. I have been writing code on a SUN Oracle systems for over five years. Regards, Jerry Did you 'grant' user access to all the tables in database club? -Original Message- From: Michael Stassen [mailto:[EMAIL PROTECTED] Sent: Monday, February 28, 2005 9:29 AM To: Gerald Preston Cc: [EMAIL PROTECTED]; mysql@lists.mysql.com Subject: Re: insert data From perldoc DBD::mysql use DBI; $dsn = DBI:mysql:database=$database;host=$hostname;port=$port; $dbh = DBI-connect($dsn, $user, $password); So it's not a syntax problem. Even if it were, we should detect the error long before calling prepare or execute. Perl is quite clearly telling you what is wrong. Originally, you got Can't call method prepare on an undefined value. for the line my $sth = $dbh-prepare( $sql ); which means that $dbh is undefined at the time of the call to prepare. Now, you are getting Can't call method execute on an un undefined value for the line $sth-execute( $group_name, $me, $daily, $item, $unit, $qty, $amount, $tax, $total ) or warn Cannot execute FIRST Statement!!\n$DBI::errstr; which means that $sth is undefined at the time of the call to execute. Are you showing us select lines of your code, rather than the actual code? My best guess right now is that you haven't taken into account that my is a scoping operator in perl, and in the lines you haven't showed us, the variables in question ($dbh or $sth) go out of scope. Michael John Doe wrote: Am Sonntag, 27. Februar 2005 22.19 schrieb Gerald Preston: Hi Gerald The object used: my $dbh=DBI-connect( 'DBI:mysql:database=club', 'xxx, 'x', { PrintError = 0} ) or die $DBI::errstr; I didn't see this part in your first post :-) Hmm... I've never seen a '=' in the first argument passed to DBI-connect... Here's an functional example I'm using: my $db ='database'; my $host ='hostname'; my $port ='1234'; $dbh=DBI-connect(DBI:mysql:$db:$host:$port, 'a_username', 'a_password', {RaiseError=1, AutoCommit=1}) or die $0: $DBI::errstr; } So, try using club instead of database=club, and a hostname too. greetings joe [nothing new below] -Original Message- From: John Doe [mailto:[EMAIL PROTECTED] Sent: Sunday, February 27, 2005 6:37 AM To: mysql@lists.mysql.com Subject: Re: insert data Hi Gerald I am trying to insert data for the first time using MySQL. In Oracle I used the following: # my $sql = insert into bar( group_name, me, daily, item, unit, qty, amount, tax, total ) # values( ?, ?, ?, ?,?,?, ?, ?, ? ) ; my $sth = $dbh-prepare( $sql ); die $dbh-errstr if $dbh-err; $sth-execute( $group_name, $me, $daily, $item, $unit, $qty, $amount, $tax, $total ) || die Cannot execute FIRST Statement!!\n$DBI::errstr; I keep getting Can't call method prepare on an un undefined value. All the name listed are correct by looking at MySQLAdmin1.3\4. Apart from David Logan's answer: You have to create the $dbh object first (man DBI); the undefined value in the error message refers to that. HTH joe -- William R. Mussatto, Senior Systems Engineer Ph. 909-920-9154 ext. 27 FAX. 909-608-7061 -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: insert data
Are you sure that the parameters in the execute are all properly defined? Try this: my $dbh = DBI-connect( 'DBI:mysql:database=club', '', '', { PrintError = 0 } ) or die $DBI::errstr; my $sql = insert into bar( group_name, me, daily, item, unit, qty, amount, tax, total ) values( ?, ?, ?, ?,?,?, ?, ?, ? ) ; my $sth = $dbh-prepare($sql) or die $dbh-errstr; # If not defined, set to '' to avoid warnings. for ($group_name, $me, $daily, $item, $unit, $qty, $amount, $tax, $total) { $_ ||= '' if ! defined $_; } $sth-execute($group_name, $me, $daily, $item, $unit, $qty, $amount, $tax, $total) or warn Cannot execute FIRST Statement!!\n$DBI::errstr; If this succeeds, review your code and make sure that each of your execute parameters have some value prior to the execute. Eamon Daly - Original Message - From: Gerald Preston [EMAIL PROTECTED] To: 'Michael Stassen' [EMAIL PROTECTED] Cc: [EMAIL PROTECTED]; mysql@lists.mysql.com Sent: Monday, February 28, 2005 3:19 PM Subject: RE: insert data Michael, This is the actual code except for the : my $dbh = DBI-connect( 'DBI:mysql:database=club', '', '', { PrintError = 0 } ) or die $DBI::errstr; my $sql = insert into wolfies( group_name, me, daily, item, unit, qty, amount, tax, total ) values( ?, ?, ?, ?,?,?, ?, ?, ? ) ; my $sth = $dbh-prepare( $sql ) or die $dbh-errstr if $dbh-err; $sth-execute( $group_name, $me, $daily, $item, $unit, $qty, $amount, $tax, $total ) or warn Cannot execute FIRST Statement!!\n$DBI::errstr; Question? When I created the database club, is there anything I needed to do concerning permissions or anything? I am lost here. I have been writing code on a SUN Oracle systems for over five years. Regards, Jerry -Original Message- From: Michael Stassen [mailto:[EMAIL PROTECTED] Sent: Monday, February 28, 2005 9:29 AM To: Gerald Preston Cc: [EMAIL PROTECTED]; mysql@lists.mysql.com Subject: Re: insert data From perldoc DBD::mysql use DBI; $dsn = DBI:mysql:database=$database;host=$hostname;port=$port; $dbh = DBI-connect($dsn, $user, $password); So it's not a syntax problem. Even if it were, we should detect the error long before calling prepare or execute. Perl is quite clearly telling you what is wrong. Originally, you got Can't call method prepare on an undefined value. for the line my $sth = $dbh-prepare( $sql ); which means that $dbh is undefined at the time of the call to prepare. Now, you are getting Can't call method execute on an un undefined value for the line $sth-execute( $group_name, $me, $daily, $item, $unit, $qty, $amount, $tax, $total ) or warn Cannot execute FIRST Statement!!\n$DBI::errstr; which means that $sth is undefined at the time of the call to execute. Are you showing us select lines of your code, rather than the actual code? My best guess right now is that you haven't taken into account that my is a scoping operator in perl, and in the lines you haven't showed us, the variables in question ($dbh or $sth) go out of scope. Michael John Doe wrote: Am Sonntag, 27. Februar 2005 22.19 schrieb Gerald Preston: Hi Gerald The object used: my $dbh=DBI-connect( 'DBI:mysql:database=club', 'xxx, 'x', { PrintError = 0} ) or die $DBI::errstr; I didn't see this part in your first post :-) Hmm... I've never seen a '=' in the first argument passed to DBI-connect... Here's an functional example I'm using: my $db ='database'; my $host ='hostname'; my $port ='1234'; $dbh=DBI-connect(DBI:mysql:$db:$host:$port, 'a_username', 'a_password', {RaiseError=1, AutoCommit=1}) or die $0: $DBI::errstr; } So, try using club instead of database=club, and a hostname too. greetings joe [nothing new below] -Original Message- From: John Doe [mailto:[EMAIL PROTECTED] Sent: Sunday, February 27, 2005 6:37 AM To: mysql@lists.mysql.com Subject: Re: insert data Hi Gerald I am trying to insert data for the first time using MySQL. In Oracle I used the following: # my $sql = insert into bar( group_name, me, daily, item, unit, qty, amount, tax, total ) # values( ?, ?, ?, ?,?,?, ?, ?, ? ) ; my $sth = $dbh-prepare( $sql ); die $dbh-errstr if $dbh-err; $sth-execute( $group_name, $me, $daily, $item, $unit, $qty, $amount, $tax, $total ) || die Cannot execute FIRST Statement!!\n$DBI::errstr; I keep getting Can't call method prepare on an un undefined value. All the name listed are correct by looking at MySQLAdmin1.3\4. Apart from David Logan's answer: You have to create the $dbh object first (man DBI); the undefined value in the error message refers to that. HTH joe -- 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
RE: insert data
William, I tried GRANT ALL ON *.* and got error 1064 4200: You have an error in your SQL syntax ?? Jerry -Original Message- From: William R. Mussatto [mailto:[EMAIL PROTECTED] Sent: Monday, February 28, 2005 3:25 PM To: mysql@lists.mysql.com Subject: RE: insert data Gerald Preston said: Michael, This is the actual code except for the : my $dbh = DBI-connect( 'DBI:mysql:database=club', '', '', { PrintError = 0 } ) or die $DBI::errstr; my $sql = insert into wolfies( group_name, me, daily, item, unit, qty, amount, tax, total ) values( ?, ?, ?, ?,?,?, ?, ?, ? ) ; my $sth = $dbh-prepare( $sql ) or die $dbh-errstr if $dbh-err; $sth-execute( $group_name, $me, $daily, $item, $unit, $qty, $amount, $tax, $total ) or warn Cannot execute FIRST Statement!!\n$DBI::errstr; Question? When I created the database club, is there anything I needed to do concerning permissions or anything? I am lost here. I have been writing code on a SUN Oracle systems for over five years. Regards, Jerry Did you 'grant' user access to all the tables in database club? -Original Message- From: Michael Stassen [mailto:[EMAIL PROTECTED] Sent: Monday, February 28, 2005 9:29 AM To: Gerald Preston Cc: [EMAIL PROTECTED]; mysql@lists.mysql.com Subject: Re: insert data From perldoc DBD::mysql use DBI; $dsn = DBI:mysql:database=$database;host=$hostname;port=$port; $dbh = DBI-connect($dsn, $user, $password); So it's not a syntax problem. Even if it were, we should detect the error long before calling prepare or execute. Perl is quite clearly telling you what is wrong. Originally, you got Can't call method prepare on an undefined value. for the line my $sth = $dbh-prepare( $sql ); which means that $dbh is undefined at the time of the call to prepare. Now, you are getting Can't call method execute on an un undefined value for the line $sth-execute( $group_name, $me, $daily, $item, $unit, $qty, $amount, $tax, $total ) or warn Cannot execute FIRST Statement!!\n$DBI::errstr; which means that $sth is undefined at the time of the call to execute. Are you showing us select lines of your code, rather than the actual code? My best guess right now is that you haven't taken into account that my is a scoping operator in perl, and in the lines you haven't showed us, the variables in question ($dbh or $sth) go out of scope. Michael John Doe wrote: Am Sonntag, 27. Februar 2005 22.19 schrieb Gerald Preston: Hi Gerald The object used: my $dbh=DBI-connect( 'DBI:mysql:database=club', 'xxx, 'x', { PrintError = 0} ) or die $DBI::errstr; I didn't see this part in your first post :-) Hmm... I've never seen a '=' in the first argument passed to DBI-connect... Here's an functional example I'm using: my $db ='database'; my $host ='hostname'; my $port ='1234'; $dbh=DBI-connect(DBI:mysql:$db:$host:$port, 'a_username', 'a_password', {RaiseError=1, AutoCommit=1}) or die $0: $DBI::errstr; } So, try using club instead of database=club, and a hostname too. greetings joe [nothing new below] -Original Message- From: John Doe [mailto:[EMAIL PROTECTED] Sent: Sunday, February 27, 2005 6:37 AM To: mysql@lists.mysql.com Subject: Re: insert data Hi Gerald I am trying to insert data for the first time using MySQL. In Oracle I used the following: # my $sql = insert into bar( group_name, me, daily, item, unit, qty, amount, tax, total ) # values( ?, ?, ?, ?,?,?, ?, ?, ? ) ; my $sth = $dbh-prepare( $sql ); die $dbh-errstr if $dbh-err; $sth-execute( $group_name, $me, $daily, $item, $unit, $qty, $amount, $tax, $total ) || die Cannot execute FIRST Statement!!\n$DBI::errstr; I keep getting Can't call method prepare on an un undefined value. All the name listed are correct by looking at MySQLAdmin1.3\4. Apart from David Logan's answer: You have to create the $dbh object first (man DBI); the undefined value in the error message refers to that. HTH joe -- William R. Mussatto, Senior Systems Engineer Ph. 909-920-9154 ext. 27 FAX. 909-608-7061 -- 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: insert data
Hi Gerald my last try... i'm not very lucky in helping in this list... This is the actual code except for the : [...] my $sth = $dbh-prepare( $sql ) or die $dbh-errstr if $dbh-err; Maybe this expression is the reason (combination of 'or' and 'if'). Example code: === my $no_error=0; # the wanted case :-) my $a=i_am_defined or die i died! if $no_error; print defined $a ? defined : not defined; === # this prints: not defined === I think the expression my $a=i_am_defined or die i died! is only evaluated if $dbh-err is false. I think you could just write: my $sth = $dbh-prepare( $sql ) or die $dbh-errstr; (omitting if $dbh-err) [...] greetings joe -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: insert data
Hi Gerald, There are some good tutorials on the web for DBI access via perl to mysql. http://www.wbluhm.com/MySQLTut.html http://perl.about.com/od/installandusemysql/l/aa090803b.htm http://dev.mysql.com/doc/mysql/en/perl.html and also http://search.cpan.org/~timb/DBI-1.47/DBI.pm You should be able to find several examples of exactly what you are trying to achieve in one of these. The first one has an almost identical query to that you are trying to achieve. If you can't select from the table, then you are unlikely to be able to insert. I would follow the tutorials, even if they are selects, and make sure they work and then all you have to do is to change the SELECT to an INSERT statement and away you go. These have a very thorough examination of the setting up of the dsn etc. I would also suggest http://dev.mysql.com/doc/mysql/en/privilege-system.html This gives a good explanation of how the GRANT/REVOKE/privileges system works with MySQL. It is slightly different than Oracle and would be well worth a read. Regards David Logan Database Administrator HP Managed Services 148 Frome Street, Adelaide 5000 Australia +61 8 8408 4273 - Work +61 417 268 665 - Mobile +61 8 8408 4259 - Fax -Original Message- From: Gerald Preston [mailto:[EMAIL PROTECTED] Sent: Tuesday, 1 March 2005 10:10 AM To: 'William R. Mussatto'; mysql@lists.mysql.com Subject: RE: insert data William, I tried GRANT ALL ON *.* and got error 1064 4200: You have an error in your SQL syntax ?? Jerry -Original Message- From: William R. Mussatto [mailto:[EMAIL PROTECTED] Sent: Monday, February 28, 2005 3:25 PM To: mysql@lists.mysql.com Subject: RE: insert data Gerald Preston said: Michael, This is the actual code except for the : my $dbh = DBI-connect( 'DBI:mysql:database=club', '', '', { PrintError = 0 } ) or die $DBI::errstr; my $sql = insert into wolfies( group_name, me, daily, item, unit, qty, amount, tax, total ) values( ?, ?, ?, ?,?, ?, ?, ?, ? ) ; my $sth = $dbh-prepare( $sql ) or die $dbh-errstr if $dbh-err; $sth-execute( $group_name, $me, $daily, $item, $unit, $qty, $amount, $tax, $total ) or warn Cannot execute FIRST Statement!!\n$DBI::errstr; Question? When I created the database club, is there anything I needed to do concerning permissions or anything? I am lost here. I have been writing code on a SUN Oracle systems for over five years. Regards, Jerry Did you 'grant' user access to all the tables in database club? -Original Message- From: Michael Stassen [mailto:[EMAIL PROTECTED] Sent: Monday, February 28, 2005 9:29 AM To: Gerald Preston Cc: [EMAIL PROTECTED]; mysql@lists.mysql.com Subject: Re: insert data From perldoc DBD::mysql use DBI; $dsn = DBI:mysql:database=$database;host=$hostname;port=$port; $dbh = DBI-connect($dsn, $user, $password); So it's not a syntax problem. Even if it were, we should detect the error long before calling prepare or execute. Perl is quite clearly telling you what is wrong. Originally, you got Can't call method prepare on an undefined value. for the line my $sth = $dbh-prepare( $sql ); which means that $dbh is undefined at the time of the call to prepare. Now, you are getting Can't call method execute on an un undefined value for the line $sth-execute( $group_name, $me, $daily, $item, $unit, $qty, $amount, $tax, $total ) or warn Cannot execute FIRST Statement!!\n$DBI::errstr; which means that $sth is undefined at the time of the call to execute. Are you showing us select lines of your code, rather than the actual code? My best guess right now is that you haven't taken into account that my is a scoping operator in perl, and in the lines you haven't showed us, the variables in question ($dbh or $sth) go out of scope. Michael John Doe wrote: Am Sonntag, 27. Februar 2005 22.19 schrieb Gerald Preston: Hi Gerald The object used: my $dbh=DBI-connect( 'DBI:mysql:database=club', 'xxx, 'x', { PrintError = 0} ) or die $DBI::errstr; I didn't see this part in your first post :-) Hmm... I've never seen a '=' in the first argument passed to DBI-connect... Here's an functional example I'm using: my $db ='database'; my $host ='hostname'; my $port ='1234'; $dbh=DBI-connect(DBI:mysql:$db:$host:$port, 'a_username', 'a_password', {RaiseError=1, AutoCommit=1}) or die $0: $DBI::errstr; } So, try using club instead of database=club, and a hostname too. greetings joe [nothing new below] -Original Message- From: John Doe [mailto:[EMAIL PROTECTED] Sent: Sunday, February 27, 2005 6:37 AM To: mysql@lists.mysql.com Subject: Re: insert data Hi Gerald I am trying to insert data for the first time using MySQL. In Oracle I used the following: # my $sql = insert into bar( group_name, me, daily, item, unit, qty, amount, tax, total
insert data
Hi! I am trying to insert data for the first time using MySQL. In Oracle I used the following: # my $sql = insert into bar( group_name, me, daily, item, unit, qty, amount, tax, total ) # values( ?, ?, ?, ?,?,?, ?, ?, ? ) ; my $sth = $dbh-prepare( $sql ); die $dbh-errstr if $dbh-err; $sth-execute( $group_name, $me, $daily, $item, $unit, $qty, $amount, $tax, $total ) || die Cannot execute FIRST Statement!!\n$DBI::errstr; I keep getting Can't call method prepare on an un undefined value. All the name listed are correct by looking at MySQLAdmin1.3\4. Any ideas? Thanks, Jerry
RE: insert data
Hi Gerald, If this is copied out of your perl code then you haven't put anything into the $sql variable. Try uncommenting the 2 lines above. Regards David Logan Database Administrator HP Managed Services 148 Frome Street, Adelaide 5000 Australia +61 8 8408 4273 - Work +61 417 268 665 - Mobile +61 8 8408 4259 - Fax -Original Message- From: Gerald Preston [mailto:[EMAIL PROTECTED] Sent: Sunday, 27 February 2005 9:33 PM To: mysql users Subject: insert data Hi! I am trying to insert data for the first time using MySQL. In Oracle I used the following: # my $sql = insert into bar( group_name, me, daily, item, unit, qty, amount, tax, total ) # values( ?, ?, ?, ?,?,?, ?, ?, ? ) ; my $sth = $dbh-prepare( $sql ); die $dbh-errstr if $dbh-err; $sth-execute( $group_name, $me, $daily, $item, $unit, $qty, $amount, $tax, $total ) || die Cannot execute FIRST Statement!!\n$DBI::errstr; I keep getting Can't call method prepare on an un undefined value. All the name listed are correct by looking at MySQLAdmin1.3\4. Any ideas? Thanks, Jerry -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: insert data
David, The actual code is uncommented: my $sql = insert into bar( group_name, me, daily, item, unit, qty, amount, tax, total ) values( ?, ?, ?, ?,?,?, ?, ?, ? ) ; Sorry, Jerry -Original Message- From: Logan, David (SST - Adelaide) [mailto:[EMAIL PROTECTED] Sent: Sunday, February 27, 2005 5:09 AM To: Gerald Preston; mysql users Subject: RE: insert data Hi Gerald, If this is copied out of your perl code then you haven't put anything into the $sql variable. Try uncommenting the 2 lines above. Regards David Logan Database Administrator HP Managed Services 148 Frome Street, Adelaide 5000 Australia +61 8 8408 4273 - Work +61 417 268 665 - Mobile +61 8 8408 4259 - Fax -Original Message- From: Gerald Preston [mailto:[EMAIL PROTECTED] Sent: Sunday, 27 February 2005 9:33 PM To: mysql users Subject: insert data Hi! I am trying to insert data for the first time using MySQL. In Oracle I used the following: # my $sql = insert into bar( group_name, me, daily, item, unit, qty, amount, tax, total ) # values( ?, ?, ?, ?,?,?, ?, ?, ? ) ; my $sth = $dbh-prepare( $sql ); die $dbh-errstr if $dbh-err; $sth-execute( $group_name, $me, $daily, $item, $unit, $qty, $amount, $tax, $total ) || die Cannot execute FIRST Statement!!\n$DBI::errstr; I keep getting Can't call method prepare on an un undefined value. All the name listed are correct by looking at MySQLAdmin1.3\4. Any ideas? Thanks, Jerry -- 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: insert data
I just created a new table with the following: CREATE TABLE `wolfies` ( `group_name` VARCHAR( 38 ) NOT NULL, `me` VARCHAR( 3 ) NOT NULL, `daily` VARCHAR( 8 ) NOT NULL, `item` VARCHAR( 60 ) NOT NULL, `unit` VARCHAR( 38 ) NOT NULL, `qty`int NOT NULL, `amount` decimal(8,2) NOT NULL, `tax`decimal(8,2) NOT NULL, `total` decimal(8,2) NOT NULL ); And get the same Can't call method prepare on an un undefined value. All the name listed are correct by looking at MySQLAdmin1.4. my $sql = insert into wolfies ( group_name, me, daily, item, unit, qty, amount, tax, total ) values( ?, ?, ?, ?,?,?, ?, ?, ? ) ; my $sth = $dbh-prepare( $sql ); die $dbh-errstr if $dbh-err; What am I ding wrong? Thanks, Jerry ---Original Message- From: Gerald Preston [mailto:[EMAIL PROTECTED] Sent: Sunday, February 27, 2005 5:13 AM To: 'Logan, David (SST - Adelaide)'; 'mysql users' Subject: RE: insert data David, The actual code is uncommented: my $sql = insert into bar( group_name, me, daily, item, unit, qty, amount, tax, total ) values( ?, ?, ?, ?,?,?, ?, ?, ? ) ; Sorry, Jerry -Original Message- From: Logan, David (SST - Adelaide) [mailto:[EMAIL PROTECTED] Sent: Sunday, February 27, 2005 5:09 AM To: Gerald Preston; mysql users Subject: RE: insert data Hi Gerald, If this is copied out of your perl code then you haven't put anything into the $sql variable. Try uncommenting the 2 lines above. Regards David Logan Database Administrator HP Managed Services 148 Frome Street, Adelaide 5000 Australia +61 8 8408 4273 - Work +61 417 268 665 - Mobile +61 8 8408 4259 - Fax -Original Message- From: Gerald Preston [mailto:[EMAIL PROTECTED] Sent: Sunday, 27 February 2005 9:33 PM To: mysql users Subject: insert data Hi! I am trying to insert data for the first time using MySQL. In Oracle I used the following: # my $sql = insert into bar( group_name, me, daily, item, unit, qty, amount, tax, total ) # values( ?, ?, ?, ?,?,?, ?, ?, ? ) ; my $sth = $dbh-prepare( $sql ); die $dbh-errstr if $dbh-err; $sth-execute( $group_name, $me, $daily, $item, $unit, $qty, $amount, $tax, $total ) || die Cannot execute FIRST Statement!!\n$DBI::errstr; I keep getting Can't call method prepare on an un undefined value. All the name listed are correct by looking at MySQLAdmin1.3\4. Any ideas? Thanks, Jerry -- 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] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: insert data
Hi Gerald, Try something like my $sth = $dbh-prepare(insert into bar(group_name,me,daily,item,unit,qty,amount,tax,total) values(?,?,?,?,?,?,?,?,?)); $sth-execute($group_name,$me,$daily,$item,$unit,$qty,$amount,$tax,$tota l) || die Cannot execute FIRST Statement!!\n$DBI::errstr; That is exactly the same format as I have running in a number of scripts. You can check out the documentation at http://search.cpan.org/~timb/DBI-1.47/DBI.pm This has tons of info on how to use the various methods/properties that are available with the DBI interface. I also use an O'Reilly book Programming the DBI Interface (I don't have it here so can't refer to the author, I think it is Tim Bunce) If you still have a problem, check your column names etc. to ensure they are correct. I'll have another check tomorrow when I get to work Regards David Logan Database Administrator HP Managed Services 148 Frome Street, Adelaide 5000 Australia +61 8 8408 4273 - Work +61 417 268 665 - Mobile +61 8 8408 4259 - Fax -Original Message- From: Gerald Preston [mailto:[EMAIL PROTECTED] Sent: Sunday, 27 February 2005 9:43 PM To: Logan, David (SST - Adelaide); 'mysql users' Subject: RE: insert data David, The actual code is uncommented: my $sql = insert into bar( group_name, me, daily, item, unit, qty, amount, tax, total ) values( ?, ?, ?, ?,?,?, ?, ?, ? ) ; Sorry, Jerry -Original Message- From: Logan, David (SST - Adelaide) [mailto:[EMAIL PROTECTED] Sent: Sunday, February 27, 2005 5:09 AM To: Gerald Preston; mysql users Subject: RE: insert data Hi Gerald, If this is copied out of your perl code then you haven't put anything into the $sql variable. Try uncommenting the 2 lines above. Regards David Logan Database Administrator HP Managed Services 148 Frome Street, Adelaide 5000 Australia +61 8 8408 4273 - Work +61 417 268 665 - Mobile +61 8 8408 4259 - Fax -Original Message- From: Gerald Preston [mailto:[EMAIL PROTECTED] Sent: Sunday, 27 February 2005 9:33 PM To: mysql users Subject: insert data Hi! I am trying to insert data for the first time using MySQL. In Oracle I used the following: # my $sql = insert into bar( group_name, me, daily, item, unit, qty, amount, tax, total ) # values( ?, ?, ?, ?,?,?, ?, ?, ? ) ; my $sth = $dbh-prepare( $sql ); die $dbh-errstr if $dbh-err; $sth-execute( $group_name, $me, $daily, $item, $unit, $qty, $amount, $tax, $total ) || die Cannot execute FIRST Statement!!\n$DBI::errstr; I keep getting Can't call method prepare on an un undefined value. All the name listed are correct by looking at MySQLAdmin1.3\4. Any ideas? Thanks, Jerry -- 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: insert data
David, Still the same error!. Jerry -Original Message- From: Logan, David (SST - Adelaide) [mailto:[EMAIL PROTECTED] Sent: Sunday, February 27, 2005 5:49 AM To: Gerald Preston; mysql users Subject: RE: insert data Hi Gerald, Try something like my $sth = $dbh-prepare(insert into bar(group_name,me,daily,item,unit,qty,amount,tax,total) values(?,?,?,?,?,?,?,?,?)); $sth-execute($group_name,$me,$daily,$item,$unit,$qty,$amount,$tax,$tota l) || die Cannot execute FIRST Statement!!\n$DBI::errstr; That is exactly the same format as I have running in a number of scripts. You can check out the documentation at http://search.cpan.org/~timb/DBI-1.47/DBI.pm This has tons of info on how to use the various methods/properties that are available with the DBI interface. I also use an O'Reilly book Programming the DBI Interface (I don't have it here so can't refer to the author, I think it is Tim Bunce) If you still have a problem, check your column names etc. to ensure they are correct. I'll have another check tomorrow when I get to work Regards David Logan Database Administrator HP Managed Services 148 Frome Street, Adelaide 5000 Australia +61 8 8408 4273 - Work +61 417 268 665 - Mobile +61 8 8408 4259 - Fax -Original Message- From: Gerald Preston [mailto:[EMAIL PROTECTED] Sent: Sunday, 27 February 2005 9:43 PM To: Logan, David (SST - Adelaide); 'mysql users' Subject: RE: insert data David, The actual code is uncommented: my $sql = insert into bar( group_name, me, daily, item, unit, qty, amount, tax, total ) values( ?, ?, ?, ?,?,?, ?, ?, ? ) ; Sorry, Jerry -Original Message- From: Logan, David (SST - Adelaide) [mailto:[EMAIL PROTECTED] Sent: Sunday, February 27, 2005 5:09 AM To: Gerald Preston; mysql users Subject: RE: insert data Hi Gerald, If this is copied out of your perl code then you haven't put anything into the $sql variable. Try uncommenting the 2 lines above. Regards David Logan Database Administrator HP Managed Services 148 Frome Street, Adelaide 5000 Australia +61 8 8408 4273 - Work +61 417 268 665 - Mobile +61 8 8408 4259 - Fax -Original Message- From: Gerald Preston [mailto:[EMAIL PROTECTED] Sent: Sunday, 27 February 2005 9:33 PM To: mysql users Subject: insert data Hi! I am trying to insert data for the first time using MySQL. In Oracle I used the following: # my $sql = insert into bar( group_name, me, daily, item, unit, qty, amount, tax, total ) # values( ?, ?, ?, ?,?,?, ?, ?, ? ) ; my $sth = $dbh-prepare( $sql ); die $dbh-errstr if $dbh-err; $sth-execute( $group_name, $me, $daily, $item, $unit, $qty, $amount, $tax, $total ) || die Cannot execute FIRST Statement!!\n$DBI::errstr; I keep getting Can't call method prepare on an un undefined value. All the name listed are correct by looking at MySQLAdmin1.3\4. Any ideas? Thanks, Jerry -- 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] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: insert data
Hi Gerald I am trying to insert data for the first time using MySQL. In Oracle I used the following: # my $sql = insert into bar( group_name, me, daily, item, unit, qty, amount, tax, total ) # values( ?, ?, ?, ?,?,?, ?, ?, ? ) ; my $sth = $dbh-prepare( $sql ); die $dbh-errstr if $dbh-err; $sth-execute( $group_name, $me, $daily, $item, $unit, $qty, $amount, $tax, $total ) || die Cannot execute FIRST Statement!!\n$DBI::errstr; I keep getting Can't call method prepare on an un undefined value. All the name listed are correct by looking at MySQLAdmin1.3\4. Apart from David Logan's answer: You have to create the $dbh object first (man DBI); the undefined value in the error message refers to that. HTH joe -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: insert data
The object used: my $dbh=DBI-connect( 'DBI:mysql:database=club', 'xxx, 'x', { PrintError = 0} ) or die $DBI::errstr; Jerry -Original Message- From: John Doe [mailto:[EMAIL PROTECTED] Sent: Sunday, February 27, 2005 6:37 AM To: mysql@lists.mysql.com Subject: Re: insert data Hi Gerald I am trying to insert data for the first time using MySQL. In Oracle I used the following: # my $sql = insert into bar( group_name, me, daily, item, unit, qty, amount, tax, total ) # values( ?, ?, ?, ?,?,?, ?, ?, ? ) ; my $sth = $dbh-prepare( $sql ); die $dbh-errstr if $dbh-err; $sth-execute( $group_name, $me, $daily, $item, $unit, $qty, $amount, $tax, $total ) || die Cannot execute FIRST Statement!!\n$DBI::errstr; I keep getting Can't call method prepare on an un undefined value. All the name listed are correct by looking at MySQLAdmin1.3\4. Apart from David Logan's answer: You have to create the $dbh object first (man DBI); the undefined value in the error message refers to that. HTH joe -- 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: insert data
Hi Gerald, The only thing I can think of is that you have a syntax error in your SQL that hasn't showed up in translation to email. Are you able to select from the database prior to the INSERT? This would confirm that your db has made a successful connection. The placeholders etc. work exactly as they do in the oracle version of the DBI. Regards David Logan Database Administrator HP Managed Services 148 Frome Street, Adelaide 5000 Australia +61 8 8408 4273 - Work +61 417 268 665 - Mobile +61 8 8408 4259 - Fax -Original Message- From: Gerald Preston [mailto:[EMAIL PROTECTED] Sent: Monday, 28 February 2005 7:49 AM To: [EMAIL PROTECTED]; mysql@lists.mysql.com Subject: RE: insert data The object used: my $dbh=DBI-connect( 'DBI:mysql:database=club', 'xxx, 'x', { PrintError = 0} ) or die $DBI::errstr; Jerry -Original Message- From: John Doe [mailto:[EMAIL PROTECTED] Sent: Sunday, February 27, 2005 6:37 AM To: mysql@lists.mysql.com Subject: Re: insert data Hi Gerald I am trying to insert data for the first time using MySQL. In Oracle I used the following: # my $sql = insert into bar( group_name, me, daily, item, unit, qty, amount, tax, total ) # values( ?, ?, ?, ?,?,?, ?, ?, ? ) ; my $sth = $dbh-prepare( $sql ); die $dbh-errstr if $dbh-err; $sth-execute( $group_name, $me, $daily, $item, $unit, $qty, $amount, $tax, $total ) || die Cannot execute FIRST Statement!!\n$DBI::errstr; I keep getting Can't call method prepare on an un undefined value. All the name listed are correct by looking at MySQLAdmin1.3\4. Apart from David Logan's answer: You have to create the $dbh object first (man DBI); the undefined value in the error message refers to that. HTH joe -- 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] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: insert data
David, I just cannot believe what a pain this is. I got past the prepare with no errors by doing the following: my $dbh = DBI-connect( 'DBI:mysql:database=club', 'xxx', 'xxx', { PrintError = 0 } ) or die $DBI::errstr; my $sql = insert into wolfies( group_name, me, daily, item, unit, qty, amount, tax, total ) values( ?, ?, ?, ?,?,?, ?, ?, ? ) ; my $sth = $dbh-prepare( $sql ) or die $dbh-errstr if $dbh-err; $sth-execute( $group_name, $me, $daily, $item, $unit, $qty, $amount, $tax, $total ) or warn Cannot execute FIRST Statement!!\n$DBI::errstr; I just do not believe this, but I get the same error (almost ): Can't call method execute on an un undefined value Jerry -Original Message- From: Logan, David (SST - Adelaide) [mailto:[EMAIL PROTECTED] Sent: Sunday, February 27, 2005 3:27 PM To: Gerald Preston; mysql@lists.mysql.com Subject: RE: insert data Hi Gerald, The only thing I can think of is that you have a syntax error in your SQL that hasn't showed up in translation to email. Are you able to select from the database prior to the INSERT? This would confirm that your db has made a successful connection. The placeholders etc. work exactly as they do in the oracle version of the DBI. Regards David Logan Database Administrator HP Managed Services 148 Frome Street, Adelaide 5000 Australia +61 8 8408 4273 - Work +61 417 268 665 - Mobile +61 8 8408 4259 - Fax -Original Message- From: Gerald Preston [mailto:[EMAIL PROTECTED] Sent: Monday, 28 February 2005 7:49 AM To: [EMAIL PROTECTED]; mysql@lists.mysql.com Subject: RE: insert data The object used: my $dbh=DBI-connect( 'DBI:mysql:database=club', 'xxx, 'x', { PrintError = 0} ) or die $DBI::errstr; Jerry -Original Message- From: John Doe [mailto:[EMAIL PROTECTED] Sent: Sunday, February 27, 2005 6:37 AM To: mysql@lists.mysql.com Subject: Re: insert data Hi Gerald I am trying to insert data for the first time using MySQL. In Oracle I used the following: # my $sql = insert into bar( group_name, me, daily, item, unit, qty, amount, tax, total ) # values( ?, ?, ?, ?,?,?, ?, ?, ? ) ; my $sth = $dbh-prepare( $sql ); die $dbh-errstr if $dbh-err; $sth-execute( $group_name, $me, $daily, $item, $unit, $qty, $amount, $tax, $total ) || die Cannot execute FIRST Statement!!\n$DBI::errstr; I keep getting Can't call method prepare on an un undefined value. All the name listed are correct by looking at MySQLAdmin1.3\4. Apart from David Logan's answer: You have to create the $dbh object first (man DBI); the undefined value in the error message refers to that. HTH joe -- 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] -- 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: insert data
I'll repeat what I said earlier, can you SELECT from this database prior to the INSERT? I can't see where the problem is, have you read the DBI doco? That has a nice trace function which can be used in this circumstance. It allows you to see the SQL prior to it being sent to the server, the response from the server etc. I highly recommend a read. Just as an aside, we obviously live in different time zones (I'm in Australia) and don't look at emails later at night because I tend to sleep 8-) Regards David Logan Database Administrator HP Managed Services 148 Frome Street, Adelaide 5000 Australia +61 8 8408 4273 - Work +61 417 268 665 - Mobile +61 8 8408 4259 - Fax -Original Message- From: Gerald Preston [mailto:[EMAIL PROTECTED] Sent: Monday, 28 February 2005 8:41 AM To: Logan, David (SST - Adelaide); mysql@lists.mysql.com Subject: RE: insert data David, I just cannot believe what a pain this is. I got past the prepare with no errors by doing the following: my $dbh = DBI-connect( 'DBI:mysql:database=club', 'xxx', 'xxx', { PrintError = 0 } ) or die $DBI::errstr; my $sql = insert into wolfies( group_name, me, daily, item, unit, qty, amount, tax, total ) values( ?, ?, ?, ?,?,?, ?, ?, ? ) ; my $sth = $dbh-prepare( $sql ) or die $dbh-errstr if $dbh-err; $sth-execute( $group_name, $me, $daily, $item, $unit, $qty, $amount, $tax, $total ) or warn Cannot execute FIRST Statement!!\n$DBI::errstr; I just do not believe this, but I get the same error (almost ): Can't call method execute on an un undefined value Jerry -Original Message- From: Logan, David (SST - Adelaide) [mailto:[EMAIL PROTECTED] Sent: Sunday, February 27, 2005 3:27 PM To: Gerald Preston; mysql@lists.mysql.com Subject: RE: insert data Hi Gerald, The only thing I can think of is that you have a syntax error in your SQL that hasn't showed up in translation to email. Are you able to select from the database prior to the INSERT? This would confirm that your db has made a successful connection. The placeholders etc. work exactly as they do in the oracle version of the DBI. Regards David Logan Database Administrator HP Managed Services 148 Frome Street, Adelaide 5000 Australia +61 8 8408 4273 - Work +61 417 268 665 - Mobile +61 8 8408 4259 - Fax -Original Message- From: Gerald Preston [mailto:[EMAIL PROTECTED] Sent: Monday, 28 February 2005 7:49 AM To: [EMAIL PROTECTED]; mysql@lists.mysql.com Subject: RE: insert data The object used: my $dbh=DBI-connect( 'DBI:mysql:database=club', 'xxx, 'x', { PrintError = 0} ) or die $DBI::errstr; Jerry -Original Message- From: John Doe [mailto:[EMAIL PROTECTED] Sent: Sunday, February 27, 2005 6:37 AM To: mysql@lists.mysql.com Subject: Re: insert data Hi Gerald I am trying to insert data for the first time using MySQL. In Oracle I used the following: # my $sql = insert into bar( group_name, me, daily, item, unit, qty, amount, tax, total ) # values( ?, ?, ?, ?,?,?, ?, ?, ? ) ; my $sth = $dbh-prepare( $sql ); die $dbh-errstr if $dbh-err; $sth-execute( $group_name, $me, $daily, $item, $unit, $qty, $amount, $tax, $total ) || die Cannot execute FIRST Statement!!\n$DBI::errstr; I keep getting Can't call method prepare on an un undefined value. All the name listed are correct by looking at MySQLAdmin1.3\4. Apart from David Logan's answer: You have to create the $dbh object first (man DBI); the undefined value in the error message refers to that. HTH joe -- 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] -- 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: insert data
At 5:38 -0600 2/27/05, Gerald Preston wrote: I just created a new table with the following: CREATE TABLE `wolfies` ( `group_name` VARCHAR( 38 ) NOT NULL, `me` VARCHAR( 3 ) NOT NULL, `daily` VARCHAR( 8 ) NOT NULL, `item` VARCHAR( 60 ) NOT NULL, `unit` VARCHAR( 38 ) NOT NULL, `qty`int NOT NULL, `amount` decimal(8,2) NOT NULL, `tax`decimal(8,2) NOT NULL, `total` decimal(8,2) NOT NULL ); And get the same Can't call method prepare on an un undefined value. I suspect that means $dbh is not defined, not that $sql is undefined. prepare() isn't being called as a method of $sql. All the name listed are correct by looking at MySQLAdmin1.4. my $sql = insert into wolfies ( group_name, me, daily, item, unit, qty, amount, tax, total ) values( ?, ?, ?, ?,?,?, ?, ?, ? ) ; my $sth = $dbh-prepare( $sql ); die $dbh-errstr if $dbh-err; What am I ding wrong? Thanks, Jerry ---Original Message- From: Gerald Preston [mailto:[EMAIL PROTECTED] Sent: Sunday, February 27, 2005 5:13 AM To: 'Logan, David (SST - Adelaide)'; 'mysql users' Subject: RE: insert data David, The actual code is uncommented: my $sql = insert into bar( group_name, me, daily, item, unit, qty, amount, tax, total ) values( ?, ?, ?, ?,?,?, ?, ?, ? ) ; Sorry, Jerry -Original Message- From: Logan, David (SST - Adelaide) [mailto:[EMAIL PROTECTED] Sent: Sunday, February 27, 2005 5:09 AM To: Gerald Preston; mysql users Subject: RE: insert data Hi Gerald, If this is copied out of your perl code then you haven't put anything into the $sql variable. Try uncommenting the 2 lines above. Regards David Logan Database Administrator HP Managed Services 148 Frome Street, Adelaide 5000 Australia +61 8 8408 4273 - Work +61 417 268 665 - Mobile +61 8 8408 4259 - Fax -Original Message- From: Gerald Preston [mailto:[EMAIL PROTECTED] Sent: Sunday, 27 February 2005 9:33 PM To: mysql users Subject: insert data Hi! I am trying to insert data for the first time using MySQL. In Oracle I used the following: # my $sql = insert into bar( group_name, me, daily, item, unit, qty, amount, tax, total ) # values( ?, ?, ?, ?,?,?, ?, ?, ? ) ; my $sth = $dbh-prepare( $sql ); die $dbh-errstr if $dbh-err; $sth-execute( $group_name, $me, $daily, $item, $unit, $qty, $amount, $tax, $total ) || die Cannot execute FIRST Statement!!\n$DBI::errstr; I keep getting Can't call method prepare on an un undefined value. All the name listed are correct by looking at MySQLAdmin1.3\4. Any ideas? Thanks, Jerry -- 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] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] -- Paul DuBois, MySQL Documentation Team Madison, Wisconsin, USA MySQL AB, www.mysql.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: insert data
Am Sonntag, 27. Februar 2005 22.19 schrieb Gerald Preston: Hi Gerald The object used: my $dbh=DBI-connect( 'DBI:mysql:database=club', 'xxx, 'x', { PrintError = 0} ) or die $DBI::errstr; I didn't see this part in your first post :-) Hmm... I've never seen a '=' in the first argument passed to DBI-connect... Here's an functional example I'm using: my $db ='database'; my $host ='hostname'; my $port ='1234'; $dbh=DBI-connect(DBI:mysql:$db:$host:$port, 'a_username', 'a_password', {RaiseError=1, AutoCommit=1}) or die $0: $DBI::errstr; } So, try using club instead of database=club, and a hostname too. greetings joe [nothing new below] -Original Message- From: John Doe [mailto:[EMAIL PROTECTED] Sent: Sunday, February 27, 2005 6:37 AM To: mysql@lists.mysql.com Subject: Re: insert data Hi Gerald I am trying to insert data for the first time using MySQL. In Oracle I used the following: # my $sql = insert into bar( group_name, me, daily, item, unit, qty, amount, tax, total ) # values( ?, ?, ?, ?,?,?, ?, ?, ? ) ; my $sth = $dbh-prepare( $sql ); die $dbh-errstr if $dbh-err; $sth-execute( $group_name, $me, $daily, $item, $unit, $qty, $amount, $tax, $total ) || die Cannot execute FIRST Statement!!\n$DBI::errstr; I keep getting Can't call method prepare on an un undefined value. All the name listed are correct by looking at MySQLAdmin1.3\4. Apart from David Logan's answer: You have to create the $dbh object first (man DBI); the undefined value in the error message refers to that. HTH joe -- 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]
insert data from text file
Should mysql version 4.0.20 support the Insert data from a textfile into table which is shown at the bottom of the page while in phpmyadmin with a database and table selected? I am getting this error: #1148 - The used command is not allowed with this MySQL version. Thanks for any help, Doug -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Insert data if not duplicate based on order
Hi, I have a table that has many rows. I want to be able to insert a new row only if has a unique field of the last 20 rows when I sort them by date. Currently before I insert a new row, I will select a specific field for 20 rows and run a for loop in php looking for a match with the data I'm getting ready to insert. If a match occurs I will skip the insert command. This normally works fine, but I have seen occasions when 2 people visit my website at the same exact time. In this case, sometimes I might insert the data twice because I think I'm spinning in the for loop for 2 site visitors simultaneously. I know this is bad syntax, but this is what I imagine a insert query to look like: INSERT INTO $table (datax, datay, dataz) VALUES ('x', 'y', 'z') IF 'x' unique WHEN ordering by 'z' DESC LIMIT 20 In this example, 'z' is a datetime field and 'x' is a varchar. I don't mind duplicate entries in my table, but I don't want duplicates entries to occur within 20 rows when sorting by date. Is this possible to do with one INSERT command? I saw the IGNORE statment in the mysql manual, but I don't think it really aplies to what I'm trying to do here. Any suggestions would be appreciated, Thanks, Grant __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: Insert data if not duplicate based on order
I don't think its possible in one query. One thing you can do is lock the table when you select the 20 rows and determine whether to do the insert. Then unlock when done. This avoids the concurrency issue you are having, but it may cause unacceptable perfomance if you have a lot of queries hitting this table. Maybe someone else has a better solution. John A. McCaskey -Original Message- From: Grant Giddens [mailto:[EMAIL PROTECTED] Sent: Monday, June 21, 2004 4:59 PM To: [EMAIL PROTECTED] Subject: Insert data if not duplicate based on order Hi, I have a table that has many rows. I want to be able to insert a new row only if has a unique field of the last 20 rows when I sort them by date. Currently before I insert a new row, I will select a specific field for 20 rows and run a for loop in php looking for a match with the data I'm getting ready to insert. If a match occurs I will skip the insert command. This normally works fine, but I have seen occasions when 2 people visit my website at the same exact time. In this case, sometimes I might insert the data twice because I think I'm spinning in the for loop for 2 site visitors simultaneously. I know this is bad syntax, but this is what I imagine a insert query to look like: INSERT INTO $table (datax, datay, dataz) VALUES ('x', 'y', 'z') IF 'x' unique WHEN ordering by 'z' DESC LIMIT 20 In this example, 'z' is a datetime field and 'x' is a varchar. I don't mind duplicate entries in my table, but I don't want duplicates entries to occur within 20 rows when sorting by date. Is this possible to do with one INSERT command? I saw the IGNORE statment in the mysql manual, but I don't think it really aplies to what I'm trying to do here. Any suggestions would be appreciated, Thanks, Grant __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- 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: ERROR ON INSERT DATA FROM FILE
adrian Greeman [EMAIL PROTECTED] wrote: I just tried to load edited data from a text file separated by | characters into a table in a simple data base I was using PhpMyAdmin version 2.5.6 and MySQL 4.0.18 running on Windows XP - I thought it was all set up right and configured properly - and earlier was able to populate the table with some initial data. Now I was trying to add more from a simple text file using the LOAD DATA LOCAL INFILE 'C:\\WINDOWS\\TEMP\\php3E.tmp' INTO TABLE `headlines` FIELDS TERMINATED BY '|' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\r\n' instruction which phpMyAdmin creates. It refused to do it and returned the error message: #1148 - The used command is not allowed with this MySQL version I feel there must be a simple explanation LOAD DATA LOCAL should be enabled for client and for the server: http://dev.mysql.com/doc/mysql/en/LOAD_DATA_LOCAL.html -- 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 -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: ERROR ON INSERT DATA FROM FILE
Thanks for the answer - but I am already the root user and have phpMyAdmin using the root also (because this is just a single computer for testing work and there are not any bit security issues). - Original Message - From: Remi Mikalsen [EMAIL PROTECTED] To: adrian Greeman [EMAIL PROTECTED] Sent: Wednesday, April 21, 2004 1:47 AM Subject: Re: ERROR ON INSERT DATA FROM FILE Hello Adrian. I'm not very experienced with MySQL, but I believe that you need special privileges to load data from a file. Normally, other than the root user will not have this kind of privilege. Without it you will probably have to ask for someone with do it for you, or give you permissions to do it. If you have access to the root account, then try it from there! Remi Mikalsen On 21 Apr 2004 at 0:17, adrian Greeman wrote: I just tried to load edited data from a text file separated by | characters into a table in a simple data base I was using PhpMyAdmin version 2.5.6 and MySQL 4.0.18 running on Windows XP - I thought it was all set up right and configured properly - and earlier was able to populate the table with some initial data. Now I was trying to add more from a simple text file using the LOAD DATA LOCAL INFILE 'C:\\WINDOWS\\TEMP\\php3E.tmp' INTO TABLE `headlines` FIELDS TERMINATED BY '|' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\r\n' instruction which phpMyAdmin creates. It refused to do it and returned the error message: #1148 - The used command is not allowed with this MySQL version I feel there must be a simple explanation May I ask if anyone can help??? Regards Adrian PS I am only on digest so please be patient if it takes a while for futher dialogue on this -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] Abraço, Remi Mikalsen E-Mail: [EMAIL PROTECTED] URL: http://www.iMikalsen.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
ERROR ON INSERT DATA FROM FILE
I just tried to load edited data from a text file separated by | characters into a table in a simple data base I was using PhpMyAdmin version 2.5.6 and MySQL 4.0.18 running on Windows XP - I thought it was all set up right and configured properly - and earlier was able to populate the table with some initial data. Now I was trying to add more from a simple text file using the LOAD DATA LOCAL INFILE 'C:\\WINDOWS\\TEMP\\php3E.tmp' INTO TABLE `headlines` FIELDS TERMINATED BY '|' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\r\n' instruction which phpMyAdmin creates. It refused to do it and returned the error message: #1148 - The used command is not allowed with this MySQL version I feel there must be a simple explanation May I ask if anyone can help??? Regards Adrian PS I am only on digest so please be patient if it takes a while for futher dialogue on this -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Inserting data into table1 should insert data into table2's FK ???
Paul Fine [EMAIL PROTECTED] wrote: If I have two tables with the first table containing a field which is FK of table 2, when I insert a value into this field, should it not automagically insert a value into that PK in the second table? No, it should not insert data in the child table. You should insert data manually. -- For technical support contracts, goto https://order.mysql.com/?ref=ensita This email is sponsored by Ensita.net http://www.ensita.net/ __ ___ ___ __ / |/ /_ __/ __/ __ \/ /Egor Egorov / /|_/ / // /\ \/ /_/ / /__ [EMAIL PROTECTED] /_/ /_/\_, /___/\___\_\___/ MySQL AB / Ensita.net ___/ www.mysql.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: Inserting data into table1 should insert data into table2's FK ???
You can't INSERT, but with mysql 4.0.15 and better, you can ON UPDATE CASCADE and ON DELETE CASCADE Daevid Vincent http://daevid.com -Original Message- From: Egor Egorov [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 26, 2003 1:24 AM To: [EMAIL PROTECTED] Subject: Re: Inserting data into table1 should insert data into table2's FK ??? Paul Fine [EMAIL PROTECTED] wrote: If I have two tables with the first table containing a field which is FK of table 2, when I insert a value into this field, should it not automagically insert a value into that PK in the second table? No, it should not insert data in the child table. You should insert data manually. -- For technical support contracts, goto https://order.mysql.com/?ref=ensita This email is sponsored by Ensita.net http://www.ensita.net/ __ ___ ___ __ / |/ /_ __/ __/ __ \/ /Egor Egorov / /|_/ / // /\ \/ /_/ / /__ [EMAIL PROTECTED] /_/ /_/\_, /___/\___\_\___/ MySQL AB / Ensita.net ___/ www.mysql.com -- 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]
Inserting data into table1 should insert data into table2's FK ???
Du If I have two tables with the first table containing a field which is FK of table 2, when I insert a value into this field, should it not automagically insert a value into that PK in the second table? Thanks! -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Problem with insert data
hi, the MySQL syntax said: INSERT [LOW_PRIORITY | DELAYED] [IGNORE] [INTO] tbl_name [(col_name,...)] VALUES ((expression | DEFAULT),...),(...),... [ ON DUPLICATE KEY UPDATE col_name=expression, ... ] or INSERT [LOW_PRIORITY | DELAYED] [IGNORE] [INTO] tbl_name [(col_name,...)] SELECT ... or INSERT [LOW_PRIORITY | DELAYED] [IGNORE] [INTO] tbl_name SET col_name=(expression | DEFAULT), ... [ ON DUPLICATE KEY UPDATE col_name=expression, ... ] also while insert into user(...) failed is an MySQL problem, while after INSERT or INTO follows table name an not a function. Regards, Rafal At 17:58 28.10.2003, Rafal Kedziorski wrote: hi, I'm using MySQL 4.0.13 and 4.0.14 (4.0.16 I will test tomorrow). And I have problems with this query: insert into user(class_id, retail_id, mandant_id, language_id, user_data_id, nickname, login_name, password, status, creation_date, last_login_date) values ('35F7A660096411D89BC0D1907F01', '1234', 2, 1, null, null, '[EMAIL PROTECTED]', 'demo', 8, '2003-10-28 17:31:36', null) but the same query with space after user insert into user (class_id, retail_id, mandant_id, language_id, user_data_id, nickname, login_name, password, status, creation_date, last_login_date) values ('35F7A660096411D89BC0D1907F01', '1234', 2, 1, null, null, '[EMAIL PROTECTED]', 'demo', 8, '2003-10-28 17:31:36', null) works. Regards, Rafal -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Problem with insert data
hi, I'm using MySQL 4.0.13 and 4.0.14 (4.0.16 I will test tomorrow). And I have problems with this query: insert into user(class_id, retail_id, mandant_id, language_id, user_data_id, nickname, login_name, password, status, creation_date, last_login_date) values ('35F7A660096411D89BC0D1907F01', '1234', 2, 1, null, null, '[EMAIL PROTECTED]', 'demo', 8, '2003-10-28 17:31:36', null) but the same query with space after user insert into user (class_id, retail_id, mandant_id, language_id, user_data_id, nickname, login_name, password, status, creation_date, last_login_date) values ('35F7A660096411D89BC0D1907F01', '1234', 2, 1, null, null, '[EMAIL PROTECTED]', 'demo', 8, '2003-10-28 17:31:36', null) works. Regards, Rafal -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Problem with insert data
Rafal Kedziorski wrote: hi, I'm using MySQL 4.0.13 and 4.0.14 (4.0.16 I will test tomorrow). And I have problems with this query: insert into user(class_id, retail_id, mandant_id, language_id, user_data_id, nickname, login_name, password, status, creation_date, last_login_date) values ('35F7A660096411D89BC0D1907F01', '1234', 2, 1, null, null, '[EMAIL PROTECTED]', 'demo', 8, '2003-10-28 17:31:36', null) This is incorrect. but the same query with space after user insert into user (class_id, retail_id, mandant_id, language_id, user_data_id, nickname, login_name, password, status, creation_date, last_login_date) values ('35F7A660096411D89BC0D1907F01', '1234', 2, 1, null, null, '[EMAIL PROTECTED]', 'demo', 8, '2003-10-28 17:31:36', null) works. This is corerect. Regards, Rafal user() is a function. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Problem with insert data
At 15:09 28.10.2003 -0600, gerald_clark wrote: Rafal Kedziorski wrote: hi, I'm using MySQL 4.0.13 and 4.0.14 (4.0.16 I will test tomorrow). And I have problems with this query: insert into user(class_id, retail_id, mandant_id, language_id, user_data_id, nickname, login_name, password, status, creation_date, last_login_date) values ('35F7A660096411D89BC0D1907F01', '1234', 2, 1, null, null, '[EMAIL PROTECTED]', 'demo', 8, '2003-10-28 17:31:36', null) This is incorrect. This query will be generated by JBoss 3.2.2. It's also a JBoss problem? but the same query with space after user insert into user (class_id, retail_id, mandant_id, language_id, user_data_id, nickname, login_name, password, status, creation_date, last_login_date) values ('35F7A660096411D89BC0D1907F01', '1234', 2, 1, null, null, '[EMAIL PROTECTED]', 'demo', 8, '2003-10-28 17:31:36', null) works. This is corerect. Regards, Rafal user() is a function. o.k. Rafal -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Shell Script to Insert Data
I am trying to create a script that will insert data. Right now I am just using something simple to test this out, but I can't get it to work. Here is what I have. mysql --user=root --password= Database_Name; INSERT INTO table_name (column_name) VALUES (value); After I run the script, I check the data, and nothing was entered. When I run each statement on it's own (not from a script file, but in the shell) Everything seems to work. It just doesn't work when you try to run it from a script. Any ideas? Mike Tuller -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: Shell Script to Insert Data
Put the full path to mysql in the script... Jeff -Original Message- From: Mike Tuller [mailto:[EMAIL PROTECTED] Sent: Friday, October 10, 2003 1:07 PM To: [EMAIL PROTECTED] Subject: Shell Script to Insert Data I am trying to create a script that will insert data. Right now I am just using something simple to test this out, but I can't get it to work. Here is what I have. mysql --user=root --password= Database_Name; INSERT INTO table_name (column_name) VALUES (value); After I run the script, I check the data, and nothing was entered. When I run each statement on it's own (not from a script file, but in the shell) Everything seems to work. It just doesn't work when you try to run it from a script. Any ideas? Mike Tuller -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/mysql? [EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Shell Script to Insert Data
The first line starts mysql. When mysql exits, the second line does nothing, as it is not a valid shell command. try : echo 'INSERT INTO table_name (column_name) VALUES (value)' | mysql --user=root --password= Database_Name Or put the second line in a file, and cat the file through a pipe to mysql. Mike Tuller wrote: I am trying to create a script that will insert data. Right now I am just using something simple to test this out, but I can't get it to work. Here is what I have. mysql --user=root --password= Database_Name; INSERT INTO table_name (column_name) VALUES (value); After I run the script, I check the data, and nothing was entered. When I run each statement on it's own (not from a script file, but in the shell) Everything seems to work. It just doesn't work when you try to run it from a script. Any ideas? Mike Tuller -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Shell Script to Insert Data
Mike Tuller wrote: I am trying to create a script that will insert data. Right now I am just using something simple to test this out, but I can't get it to work. Here is what I have. mysql --user=root --password= Database_Name; INSERT INTO table_name (column_name) VALUES (value); After I run the script, I check the data, and nothing was entered. When I run each statement on it's own (not from a script file, but in the shell) Everything seems to work. It just doesn't work when you try to run it from a script. Any ideas? Mike Tuller Unless I'm missing something, you can do the following: Put the sql commends in a file called commands.sql then run mysql -u root -p @@@ db commands.sql you can put that in a script if you like -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: Shell Script to Insert Data
The way I usually do it is this.. I have a shell scipt called query It contains: /fullpath/mysql --user=root --password= Database_Name I then make new scripts for the queries as such: (query file name: Select_all.sql) Select * from Table where blah=foo; To run this I then execute the command ./query Select_all.sql This outputs the results to the standard out. You could also ./query Select_all.sql /tmp/some_output_file Hope this helps. Jeff -Original Message- From: Mike Tuller [mailto:[EMAIL PROTECTED] Sent: Friday, October 10, 2003 1:07 PM To: [EMAIL PROTECTED] Subject: Shell Script to Insert Data I am trying to create a script that will insert data. Right now I am just using something simple to test this out, but I can't get it to work. Here is what I have. mysql --user=root --password= Database_Name; INSERT INTO table_name (column_name) VALUES (value); After I run the script, I check the data, and nothing was entered. When I run each statement on it's own (not from a script file, but in the shell) Everything seems to work. It just doesn't work when you try to run it from a script. Any ideas? Mike Tuller -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/mysql? [EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
INSERT data into multiple tables
Hello, I have a question about INSERTing data into 2 different tables with one statement. Can you do this? INSERT INTO table1 (name,address,phone) VALUES ( ' USER ', ' USERADDY ',' USERPHONE') AND table2 (name) VALUES( ' USER '); -Dan
Re: INSERT data into multiple tables
On Wed, 24 Sep 2003 14:23:04 -0500 Dan J. Rychlik [EMAIL PROTECTED] wrote: Hello, I have a question about INSERTing data into 2 different tables with one statement. Can you do this? INSERT INTO table1 (name,address,phone) VALUES ( ' USER ', ' USERADDY ',' USERPHONE') AND table2 (name) VALUES( ' USER '); No. Use 2 queries for that: INSERT INTO table1 (name,address,phone) VALUES ( ' USER ', ' USERADDY ',' USERPHONE'); INSERT INTO table2 (name) VALUES( ' USER '); --- WBR, Antony Dovgal aka tony2001 [EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Can't insert data from Apache/PHP
having register_globals 'on' is only a security risk if the code is sloppy. We're in agreement here, Jay. I see turning register_globals off as a band-aid fix for poor coding rather than a rule of thumb. That 'off' was made the default only recently emphasizes this, in my opinion. Edward Dudlik Becoming Digital www.becomingdigital.com - Original Message - From: Jay Blanchard [EMAIL PROTECTED] To: CM Miller [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Wednesday, 11 June, 2003 08:04 Subject: RE: Can't insert data from Apache/PHP [snip] Sorry, but I am a bit behind on MySQL digest, but isn't turning Register Globals 'on' for php a security risk? [/snip] We recently had this discussion on the PHP-General list and the upshot is that having register_globals 'on' is only a security risk if the code is sloppy. PHP allows this as the variables are not strongly typed and most developer fail to do any checking of variables to make sure that they contain what they want them to contain. Turning register_globals 'off' does not take care of that. It just adds another layer of abstraction to certain vaariables (such as GET, POST, etc) which is still vulnerable if the developer does not do a good job of taking care with his or her variables. HTH! Jay -- 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: Can't insert data from Apache/PHP
[snip] Sorry, but I am a bit behind on MySQL digest, but isn't turning Register Globals 'on' for php a security risk? [/snip] We recently had this discussion on the PHP-General list and the upshot is that having register_globals 'on' is only a security risk if the code is sloppy. PHP allows this as the variables are not strongly typed and most developer fail to do any checking of variables to make sure that they contain what they want them to contain. Turning register_globals 'off' does not take care of that. It just adds another layer of abstraction to certain vaariables (such as GET, POST, etc) which is still vulnerable if the developer does not do a good job of taking care with his or her variables. HTH! Jay -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Can't insert data from Apache/PHP
On Tuesday 10 June 2003 22:49, CM Miller wrote: globals back to ON. Sorry, but I am a bit behind on MySQL digest, but isn't turning Register Globals 'on' for php a security risk? Yes. He needs to take a look at the documentation on the PHP website. I also sent instructions on how to make things work by reading the $_POST and $_GET and $_SERVER variables. I also have a couple of code snippets to remove other potential offending characters from input. Curtis -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Can't insert data from Apache/PHP
I started troubleshooting the code and discovered the problem was the new register globals which is defaulted to off in PHP 4.22. The PHP wasn't holding session and wasn't inserting the records into the mySQL database. I got it working now by switching the register globals back to ON. Sorry, but I am a bit behind on MySQL digest, but isn't turning Register Globals 'on' for php a security risk? Here was an example given at our local php meetup meeting: Local index.php: ?php include ($page ); ? Remote cracked.php: ?php passthru (cat /etc/passwd ); ? URL: http://localwebserver.com/index.php?page=offsite.com/cracked.php = GTFG GAIM ID: cmmiller1973 __ Do you Yahoo!? Yahoo! Calendar - Free online calendar with sync to Outlook(TM). http://calendar.yahoo.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Can't insert data from Apache/PHP
So the next step would be to provide us with the code so that we might try to help you. :) Edward Dudlik Becoming Digital www.becomingdigital.com - Original Message - From: ComCity [EMAIL PROTECTED] To: Becoming Digital [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Sunday, 08 June, 2003 01:55 Subject: Re: Can't insert data from Apache/PHP Yep...figured that out. Thank You - Original Message - From: Becoming Digital [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, June 07, 2003 6:48 PM Subject: Re: Can't insert data from Apache/PHP That points to a fault in your coding because phpMyAdmin *is* PHP running via the web server. Edward Dudlik Becoming Digital www.becomingdigital.com - Original Message - From: ComCity [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, 07 June, 2003 21:09 Subject: More: Can't insert data from Apache/PHP It looks like I can insert data through phpMyadmin without issue. The only place I can't insert data is through PHP running via the web server. To: [EMAIL PROTECTED] Sent: Saturday, June 07, 2003 5:03 PM Subject: Can't insert data from Apache/PHP I've had to reinstall Linux/Apache and mySQL. The databases are restored, the data looks to be there, the permissions look to be there. However, I can't seem INSERT data into the tablesits the only thing I can't do...and I don't see a problem with the permissions. Don't get any errors on the webpage but nothing happens. If I do a select, it works just fine. I have the database permissions set wide open for troubleshooting. RWL owner X XX group X XX other X XX Owner= mysql group= mysql What am I missing? Its got to be something stupid and something small Thank You very much. Michael B. -- 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] -- 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: Can't insert data from Apache/PHP
Oh sorry...my bad. :) I started troubleshooting the code and discovered the problem was the new register globals which is defaulted to off in PHP 4.22. The PHP wasn't holding session and wasn't inserting the records into the mySQL database. I got it working now by switching the register globals back to ON. - Original Message - From: Becoming Digital [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, June 08, 2003 1:35 AM Subject: Re: Can't insert data from Apache/PHP So the next step would be to provide us with the code so that we might try to help you. :) Edward Dudlik Becoming Digital www.becomingdigital.com - Original Message - From: ComCity [EMAIL PROTECTED] To: Becoming Digital [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Sunday, 08 June, 2003 01:55 Subject: Re: Can't insert data from Apache/PHP Yep...figured that out. Thank You - Original Message - From: Becoming Digital [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, June 07, 2003 6:48 PM Subject: Re: Can't insert data from Apache/PHP That points to a fault in your coding because phpMyAdmin *is* PHP running via the web server. Edward Dudlik Becoming Digital www.becomingdigital.com - Original Message - From: ComCity [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, 07 June, 2003 21:09 Subject: More: Can't insert data from Apache/PHP It looks like I can insert data through phpMyadmin without issue. The only place I can't insert data is through PHP running via the web server. To: [EMAIL PROTECTED] Sent: Saturday, June 07, 2003 5:03 PM Subject: Can't insert data from Apache/PHP I've had to reinstall Linux/Apache and mySQL. The databases are restored, the data looks to be there, the permissions look to be there. However, I can't seem INSERT data into the tablesits the only thing I can't do...and I don't see a problem with the permissions. Don't get any errors on the webpage but nothing happens. If I do a select, it works just fine. I have the database permissions set wide open for troubleshooting. RWL owner X XX group X XX other X XX Owner= mysql group= mysql What am I missing? Its got to be something stupid and something small Thank You very much. Michael B. -- 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] -- 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] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Can't insert data from Apache/PHP
I've had to reinstall Linux/Apache and mySQL. The databases are restored, the data looks to be there, the permissions look to be there. However, I can't seem INSERT data into the tablesits the only thing I can't do...and I don't see a problem with the permissions. Don't get any errors on the webpage but nothing happens. If I do a select, it works just fine. I have the database permissions set wide open for troubleshooting. RWL owner X XX group X XX other X XX Owner= mysql group= mysql What am I missing? Its got to be something stupid and something small Thank You very much. Michael B. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
More: Can't insert data from Apache/PHP
It looks like I can insert data through phpMyadmin without issue. The only place I can't insert data is through PHP running via the web server. To: [EMAIL PROTECTED] Sent: Saturday, June 07, 2003 5:03 PM Subject: Can't insert data from Apache/PHP I've had to reinstall Linux/Apache and mySQL. The databases are restored, the data looks to be there, the permissions look to be there. However, I can't seem INSERT data into the tablesits the only thing I can't do...and I don't see a problem with the permissions. Don't get any errors on the webpage but nothing happens. If I do a select, it works just fine. I have the database permissions set wide open for troubleshooting. RWL owner X XX group X XX other X XX Owner= mysql group= mysql What am I missing? Its got to be something stupid and something small Thank You very much. Michael B. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Can't insert data from Apache/PHP
That points to a fault in your coding because phpMyAdmin *is* PHP running via the web server. Edward Dudlik Becoming Digital www.becomingdigital.com - Original Message - From: ComCity [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, 07 June, 2003 21:09 Subject: More: Can't insert data from Apache/PHP It looks like I can insert data through phpMyadmin without issue. The only place I can't insert data is through PHP running via the web server. To: [EMAIL PROTECTED] Sent: Saturday, June 07, 2003 5:03 PM Subject: Can't insert data from Apache/PHP I've had to reinstall Linux/Apache and mySQL. The databases are restored, the data looks to be there, the permissions look to be there. However, I can't seem INSERT data into the tablesits the only thing I can't do...and I don't see a problem with the permissions. Don't get any errors on the webpage but nothing happens. If I do a select, it works just fine. I have the database permissions set wide open for troubleshooting. RWL owner X XX group X XX other X XX Owner= mysql group= mysql What am I missing? Its got to be something stupid and something small Thank You very much. Michael B. -- 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: Can't insert data from Apache/PHP
Yep...figured that out. Thank You - Original Message - From: Becoming Digital [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, June 07, 2003 6:48 PM Subject: Re: Can't insert data from Apache/PHP That points to a fault in your coding because phpMyAdmin *is* PHP running via the web server. Edward Dudlik Becoming Digital www.becomingdigital.com - Original Message - From: ComCity [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, 07 June, 2003 21:09 Subject: More: Can't insert data from Apache/PHP It looks like I can insert data through phpMyadmin without issue. The only place I can't insert data is through PHP running via the web server. To: [EMAIL PROTECTED] Sent: Saturday, June 07, 2003 5:03 PM Subject: Can't insert data from Apache/PHP I've had to reinstall Linux/Apache and mySQL. The databases are restored, the data looks to be there, the permissions look to be there. However, I can't seem INSERT data into the tablesits the only thing I can't do...and I don't see a problem with the permissions. Don't get any errors on the webpage but nothing happens. If I do a select, it works just fine. I have the database permissions set wide open for troubleshooting. RWL owner X XX group X XX other X XX Owner= mysql group= mysql What am I missing? Its got to be something stupid and something small Thank You very much. Michael B. -- 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] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: Connecting M. Access Forms to insert data into mysql
Have you tried Linking the MySQL tables into access? I do not know why you would still have a memo field. Also if you need it you could map the memo field in Access to a TEXT or a BLOBTEXT in MySQL. If you have access to Visual Basic it could be a bettere option. HTH JFernando ** sql ** -Original Message- From: Grant Cooper [mailto:[EMAIL PROTECTED]] Sent: December 14, 2002 22:11 To: MySQL List Subject: Re: Connecting M. Access Forms to insert data into mysql I've installed about 12 client gui's and here's my conclusion. DBQwikEdit - has the best editor for Data Entry - nice form to add one record at a time - similar to access forms (I want this) - As far as I can tell, is the only product that has this feture http://www.mysqlstudio.com/ - nice for management - but the shit for a single user wanting to add data like access in forms. My problem is if I use Access for the front end it doesn't always out put the memo fields right. So I want a client GUI that specifically will allow one record / page. Making it very user friendly. Is using Access the way to go or is there a product I'm missing? - Original Message - From: Grant Cooper [EMAIL PROTECTED] To: MySQL List [EMAIL PROTECTED] Sent: Saturday, December 14, 2002 6:49 PM Subject: Connecting M. Access Forms to insert data into mysql I am trying to find a package to insert data. And was wondering if I can use odbc drivers to connect Access to mysql in real 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 - 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
Connecting M. Access Forms to insert data into mysql
I am trying to find a package to insert data. And was wondering if I can use odbc drivers to connect Access to mysql in real 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: Connecting M. Access Forms to insert data into mysql
I've installed about 12 client gui's and here's my conclusion. DBQwikEdit - has the best editor for Data Entry - nice form to add one record at a time - similar to access forms (I want this) - As far as I can tell, is the only product that has this feture http://www.mysqlstudio.com/ - nice for management - but the shit for a single user wanting to add data like access in forms. My problem is if I use Access for the front end it doesn't always out put the memo fields right. So I want a client GUI that specifically will allow one record / page. Making it very user friendly. Is using Access the way to go or is there a product I'm missing? - Original Message - From: Grant Cooper [EMAIL PROTECTED] To: MySQL List [EMAIL PROTECTED] Sent: Saturday, December 14, 2002 6:49 PM Subject: Connecting M. Access Forms to insert data into mysql I am trying to find a package to insert data. And was wondering if I can use odbc drivers to connect Access to mysql in real 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 - 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
Not able to insert data
I have installed MySQL 3.23.47 in a Windows 98 machine and created a a table count. I have installed Apache Server on 98 machine and try to execute the following PHP script to insert the data. I was not able to post the data and got an error Method Not Allowed The requested method POST is not allowed for the URL /bangla/count/entry.php. Apache/1.3.26 Server at vinod.com Port 80 THE SCRIPT WHICH I HAD WRITTEN IS ?php mysql_connect(localhost,root,vinodb)or die(could not connect); mysql_select_db(bangla)or die(could not select database);? $query=insert into count (count)values ( 30); mysql_query($query) or die(mysql_error());? This script works fine with MySQL and Appache in a Linux machine. Please suggest me how to solve the problem Regards, Vinod. - Sify Mail - now with Anti-virus protection powered by Trend Micro, USA. Know more at http://mail.sify.com Want to get into IIM? Take the Sify Mock CAT now! http://education.sify.com/mockcat - 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: Not able to insert data
VINOD wrote: I have installed MySQL 3.23.47 in a Windows 98 machine and created a a table count. I have installed Apache Server on 98 machine and try to execute the following PHP script to insert the data. I was not able to post the data and got an error Method Not Allowed The requested method POST is not allowed for the URL /bangla/count/entry.php. Apache/1.3.26 Server at vinod.com Port 80 THE SCRIPT WHICH I HAD WRITTEN IS ?php mysql_connect(localhost,root,vinodb)or die(could not connect); mysql_select_db(bangla)or die(could not select database);? $query=insert into count (count)values (30); mysql_query($query) or die(mysql_error());? This script works fine with MySQL and Appache in a Linux machine. Please suggest me how to solve the problem Regards, Vinod. This error is not related to MySQL; it is an Apache error. You should review your Apache configuration. If this script is the first you are trying on this machine, you should make sure you don't have problems with your Apache/PHP setup with a simple PHP script first. Regards, -- Joseph Bueno NetClub - 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: Easy way to insert data in MySQL DB
Also check out http://www.mysqlfront.de. No disrespect intended to MySQL. :) Regards, Kevin Smith -Original Message- From: Victoria Reznichenko [EMAIL PROTECTED] To: [EMAIL PROTECTED] Date: Tue, 26 Feb 2002 11:14:01 +0200 Subject: Easy way to insert data in MySQL DB Admin/Admin, Tuesday, February 26, 2002, 10:07:25 AM, you wrote: AA Hi, AAThx for all your help, I can export the tables in exportSQL scripts. AABut how to make the procedure of inserting data more easy instead of AA using mysql daemon od MySQL GUI?? Both of them need to use Sql language to AA insert data. Any software or tools like Microsoft Access or Lotus Approach AA which can make ppl who are not familar to MySQL can insert data very easy?? AA And they are free? Take a look at MyCC. See in the manual: http://www.mysql.com/downloads/gui-mycc.html -- For technical support contracts, goto https://order.mysql.com/ 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 - 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
Easy way to insert data in MySQL DB
Hi, Thx for all your help, I can export the tables in exportSQL scripts. But how to make the procedure of inserting data more easy instead of using mysql daemon od MySQL GUI?? Both of them need to use Sql language to insert data. Any software or tools like Microsoft Access or Lotus Approach which can make ppl who are not familar to MySQL can insert data very easy?? And they are free? - 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
Cannot insert data into table
Hello all. This is a snippet from my JavaBean that I'm using to insert data into MySql database. The bean is working perfectly alright but I can't insert data into the user table. Please help and do tell what I'm doing wrong here. This is the code: public String saveToDB() { try { Class.forName("org.gjt.mm.mysql.Driver").newInstance(); try { cn = DriverManager.getConnection("jdbc:mysql://localhost/users"); try{ Statement st = cn.createStatement(); String sql = "insert into user Values('"+userName+"','"+password1+"')"; st.executeQuery(sql); return "success"; } catch(SQLException e){ return e.toString(); } } catch(SQLException e){ return e.toString(); } } catch(ClassNotFoundException e){ return e.toString(); } catch(Exception e) { return e.toString(); } } Thanks. Rohit. --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.237 / Virus Database: 115 - Release Date: 07/03/2001 - 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