Re: [PHP-DB] INSERT Question

2003-03-31 Thread Charles Kline
How would I modify the code below to handle an UPDATE? On Sunday, March 30, 2003, at 07:19 PM, Charles Kline wrote: then I built the INSERT like so: foreach($article_keys as $articleid) { $insert[] = ('$v_ib_id','$articleid'); } $article_sql = INSERT INTO tbl_ib_articles (issue_brief,article)

Re: [PHP-DB] INSERT Question

2003-03-31 Thread Charles Kline
Everything looks okay with this when I echo the sql string: INSERT INTO tbl_ib_articles (issue_brief,article) VALUES ('24','30'),('24','20'),('24','31') My question was, what do I need to change to make this an UPDATE? Thanks, Charles On Monday, March 31, 2003, at 08:30 PM, [EMAIL PROTECTED]

Re: [PHP-DB] INSERT Question

2003-03-31 Thread Mustafa Ocak
Message - From: Charles Kline [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Tuesday, April 01, 2003 5:56 AM Subject: Re: [PHP-DB] INSERT Question Everything looks okay with this when I echo the sql string: INSERT INTO tbl_ib_articles (issue_brief,article) VALUES ('24','30

RE: [PHP-DB] INSERT Question

2003-03-29 Thread John W. Holmes
I was wondering what is the best way to insert multiple records into a table? Here is the scenario... I have a form which has 5 select menus as part of the data that gets entered. Most of the data goes into a table called tbl_reports. Each of these 5 menus contains the same list of people

Re: [PHP-DB] INSERT Question

2003-03-29 Thread Charles Kline
Since I don't totally understand (newbie) I will show you an example of the form. form select name=person1 option value=1Joe Smith/option etc. /select input type=radio name=person1yn value=Yes Y input type=radio name=person1yn value=No N select name=person2 option value=1Joe Smith/option etc.

RE: [PHP-DB] INSERT Question

2003-03-29 Thread John W. Holmes
Since I don't totally understand (newbie) I will show you an example of the form. form select name=person1 option value=1Joe Smith/option etc. /select input type=radio name=person1yn value=Yes Y input type=radio name=person1yn value=No N So if the 'Y' radio button is chosen, you'll

Re: [PHP-DB] INSERT Question

2003-03-29 Thread Charles Kline
John, Thanks. Yes that is a big help. The radio button is actually not used for that purpose (sorry that was a bit confusing of me to put in without an explanation). For each person selected, the radio button Y/N relates to whether they are an author of the report or just a contributer. I

Re: [PHP-DB] INSERT Question

2003-03-29 Thread Charles Kline
John, I modified my form, but not having much luck. Here is my new form (so far): ** I need to add 4 more selects, not sure how to name them ** select name=investigator[person] option value=0Choose person/option option value=1064618047Paul A/option option value=1655387822Katrina A/option option

RE: [PHP-DB] INSERT Question

2003-03-29 Thread Peter Lovatt
Hi you need to create 5 selects, all named investigator[] with index 1-5 (or 0-4), with the option set to empty for no selection. this will return an array investigator[1] = '1064618047' investigator_yesno[1] = 'Y' investigator[2] = '1649815377' investigator_yesno[2] = 'N' for example form

RE: [PHP-DB] INSERT Question

2003-03-29 Thread John W. Holmes
: Charles Kline [mailto:[EMAIL PROTECTED] Sent: Saturday, March 29, 2003 9:11 PM To: Peter Lovatt Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DB] INSERT Question Big help! Thanks much. Now... to figure out how to create that kind of form in HTML_QuickForm (hehehe). If I can't then I just make

Re: [PHP-DB] INSERT Question

2003-03-29 Thread Charles Kline
. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -Original Message- From: Charles Kline [mailto:[EMAIL PROTECTED] Sent: Saturday, March 29, 2003 9:11 PM To: Peter Lovatt Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DB] INSERT

RE: [PHP-DB] INSERT question. 2 pointers.

2002-11-22 Thread Hutchins, Richard
Actually, according to the MySQL manual and experience, if you don't want to insert data into each column in a table, you can specify the columns you DO want to insert data into. See below: $sql = INSERT INTO myTable (col1,col3,col4) VALUES ('$val1','$val2','$val3'); As you can see, the above

RE: [PHP-DB] INSERT question...

2002-11-20 Thread Aaron Wolski
Try... $query = INSERT INTO accounts (accnts,timestamp) VALUES(''.$accnts[0].'','TIMESTAMP(10)'); Might work? Aaron -Original Message- From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED]] Sent: November 20, 2002 2:16 PM To: '[EMAIL PROTECTED]' Subject: [PHP-DB] INSERT question...

Re: [PHP-DB] INSERT question...

2002-11-20 Thread 1LT John W. Holmes
Try... $query = INSERT INTO accounts (accnts,timestamp) VALUES(''.$accnts[0].'','TIMESTAMP(10)'); Might work? Aaron For the OP, you don't really want to insert the text TIMESTAMP(10) into a column, do you? If you want the current 10-digit timestamp, then you can just use NOW() or

RE: [PHP-DB] INSERT question...

2002-11-20 Thread Aaron Wolski
Hmm You learn something new everyday :) Aaron -Original Message- From: 1LT John W. Holmes [mailto:[EMAIL PROTECTED]] Sent: November 20, 2002 2:27 PM To: Aaron Wolski; 'NIPP, SCOTT V (SBCSI)'; [EMAIL PROTECTED] Subject: Re: [PHP-DB] INSERT question... Try... $query = INSERT

Re: [PHP-DB] INSERT question...

2002-11-20 Thread Ryan Gallagher
Quoting NIPP, SCOTT V (SBCSI) [EMAIL PROTECTED]: I have an INSERT statement that I cannot quiet get working. The table that this data is being put into has 7 columns, but I only care about putting in the data from the first two columns at this time. The first column is an array

RE: [PHP-DB] INSERT question...

2002-11-20 Thread NIPP, SCOTT V (SBCSI)
. Holmes'; NIPP, SCOTT V (SBCSI); [EMAIL PROTECTED] Subject: RE: [PHP-DB] INSERT question... Hmm You learn something new everyday :) Aaron -Original Message- From: 1LT John W. Holmes [mailto:[EMAIL PROTECTED]] Sent: November 20, 2002 2:27 PM To: Aaron Wolski; 'NIPP, SCOTT V (SBCSI

Re: [PHP-DB] INSERT question...

2002-11-20 Thread 1LT John W. Holmes
OK. This sounds great, but now I am getting a completely different error message. You have an error in your SQL syntax near '-sys) VALUES('sn4265-turner')' at line 1 Here is the INSERT statement: $query = INSERT INTO accounts (id-sys) VALUES('.$accnts[0].'); Do I have to rename the

Re: [PHP-DB] INSERT question...

2002-11-20 Thread Ryan Gallagher
Quoting 1LT John W. Holmes [EMAIL PROTECTED]: OK. This sounds great, but now I am getting a completely different error message. You have an error in your SQL syntax near '-sys) VALUES('sn4265-turner')' at line 1 Here is the INSERT statement: $query = INSERT INTO accounts

RE: [PHP-DB] INSERT question...

2002-11-20 Thread NIPP, SCOTT V (SBCSI)
PROTECTED]] Sent: Wednesday, November 20, 2002 2:21 PM To: NIPP, SCOTT V (SBCSI); 'Aaron Wolski'; [EMAIL PROTECTED] Subject: Re: [PHP-DB] INSERT question... OK. This sounds great, but now I am getting a completely different error message. You have an error in your SQL syntax near '-sys) VALUES

Re: [PHP-DB] INSERT question...

2002-11-20 Thread 1LT John W. Holmes
$query = INSERT INTO accounts (`id-sys`, rtime) VALUES('.$accnts[0].', 'NOW()'); Remove the quotes around NOW(). It's a function, not a string. ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

RE: [PHP-DB] INSERT question...

2002-11-20 Thread NIPP, SCOTT V (SBCSI)
, November 20, 2002 2:47 PM To: NIPP, SCOTT V (SBCSI); 'Aaron Wolski'; [EMAIL PROTECTED] Subject: Re: [PHP-DB] INSERT question... $query = INSERT INTO accounts (`id-sys`, rtime) VALUES('.$accnts[0].', 'NOW()'); Remove the quotes around NOW(). It's a function, not a string. ---John Holmes