Re: [PHP-DB] Connecting to two MySQL databases

2005-10-01 Thread Charles Kline
On Sep 30, 2005, at 11:51 AM, Larry E. Ullman wrote: I had this problem a while ago, when you try to create the second connection to the database with the same login credentials, i.e username and password. If mysql / php detect there is a connection already established with those details

[PHP-DB] Connecting to two MySQL databases

2005-09-29 Thread Charles Kline
Hi all, I am working on an application that requires me to connect to two MySQL databases both hosted on the same server. I have an existing set of class files I created to handle the db connection to the main database. To connect to the second database, I duplicated my db class files

[PHP-DB] Re-ordering items

2003-04-03 Thread Charles Kline
Hi all, I have a table that contains the 'Sort Order' of some stories which are kept in another table. I want to be able to 're-order' these items but I am not sure how to go about this (technique wise). For example: I have a form with a series of select menus. Each menu represents the

[PHP-DB] using a variable as values in an array

2003-03-31 Thread Charles Kline
I am trying to build an array from the results of a query on a mySQL table. I am using a loop to create this string in a variable $mystring: '30'=true, '20'=true I then need to use it like this: $defaultValues['ib_article'] = array($mystring); It isn't working. I am sure there is a better

Re: [PHP-DB] using a variable as values in an array

2003-03-31 Thread Charles Kline
, at 04:32 PM, Jennifer Goodie wrote: Instead of building a string in your loop do the assignment in the loop I have no idea what is being pulled from where, so I can't really give a good example -Original Message- From: Charles Kline [mailto:[EMAIL PROTECTED] Sent: Monday, March 31, 2003 1:25

Re: [PHP-DB] using a variable as values in an array

2003-03-31 Thread Charles Kline
= $thevalue){ $defaultValues['ib_article'][$thevalue] = 'true'; } I'm not sure if the indices line up exactly with what you had in mind, but I'm confident you can play with it to get what you want. -Original Message- From: Charles Kline [mailto:[EMAIL PROTECTED] Sent: Monday, March 31

[PHP-DB] initialize assoc arrays

2003-03-31 Thread Charles Kline
hi all, i am changing the title are reposting - i have a clearer idea now of what i am trying to do... what is the syntax to initialize an associative array with values returned in a query where the key in the array is coming from the query and the value is static value of true? i want to

[PHP-DB] Solved! Re: initialize assoc arrays

2003-03-31 Thread Charles Kline
Hey. I just figured it out! So simple too :) $myarray = array(); foreach ($sth_opt as $thekey = $thevalue){ $myarray[$thevalue] = true; } On Monday, March 31, 2003, at 06:05 PM, Charles Kline wrote: hi all, i am changing the title are reposting - i have a clearer idea now of what i am

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]

[PHP-DB] naming conventions

2003-03-30 Thread Charles Kline
hi all, i was just wondering if there are any naming conventions when creating database connections. most of my books use $sql = SQL STRING; and $sth = $db-query() or $result = $db-query() I have no idea what sth stands for in this case, but was curious how others name stuff. thanks

[PHP-DB] INSERT Question

2003-03-29 Thread Charles Kline
Hi there. 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

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 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 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