RE: [PHP-DB] Help!!!
In the second loop you do an array_shift($entry) which should be array_shift($all). Perhaps a foreach loop would be easier: ?php foreach ($entry as $value) { $update = UPDATE accounts SET ctime=NOW() WHERE id_sys=' . $value. '; $results = mysql_query($update, $Prod) or die(mysql_error()); } foreach ($allas $value) { $update = UPDATE accounts SET ctime=NOW() WHERE id_sys=' . $value. '; $results = mysql_query($update, $Prod) or die(mysql_error()); } ? Jos -Original Message- From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED] Sent: 18 May 2005 22:47 To: php-db@lists.php.net Subject: [PHP-DB] Help!!! This is driving me absolutely nuts!!! I have a page that has some checkboxes that will cause a database update for the selected items. This page is a self referencing form page that never seems to work. I have no idea what I am doing wrong. Here are the code portions that I think are relevant. This is the top of the page here: ?php while(isset($entry[0])) { $redir = set; $tmp = $entry[0]; $update = UPDATE accounts SET ctime=NOW() WHERE id_sys='.$tmp.'; $results = mysql_query($update, $Prod) or die(mysql_error()); array_shift($entry); } while(isset($all[0])) { $redir = set; $tmp = $all[0]; $update = UPDATE accounts SET ctime=NOW() WHERE id_sys='.$tmp.'; $results = mysql_query($update, $Prod) or die(mysql_error()); array_shift($entry); } if (isset($redir)) { header('Location: link address'); } $SBCUID = $_GET['SBCUID']; This is the point at which some queries build the page content ... Lots of stuff clipped ... Here is the guts of what builds the check boxes. Everything displays properly form method=post action=user_details.php ?php while ($list2 = mysql_fetch_assoc($requests_accounts)) { $all[] = $list2['id_sys']; ? tr bgcolor=#CC tddiv align=center?php echo $list2['system']; ?nbsp; /div/td tddiv align=center?php echo $list2['gid']; ?nbsp; /div/td tddiv align=center?php echo $list2['shell']; ?nbsp; /div/td tddiv align=center?php echo $list2['rtime']; ?nbsp; /div/td tddiv align=center?php echo $list2['atime']; ?nbsp; /div/td tddiv align=centerinput name=entry[] type=checkbox value=?php echo $list2['id_sys']; ?/div/td /tr ?php } ;? /table div align=center input type=submit value=Updateinput name=all[] type=submit value=Update All /div /form The initial load of the page displays everything properly. The problem is when I hit the Update or Update All buttons the page reloads, but never actually makes it into the database update loops. I cannot figure out what I am doing wrong here. I have used this kind of code before and I am at a complete loss as to the problem. Please help so I can actually get past this and onto some realy work. Thanks in advance. Scott Nipp Phone: (214) 858-1289 E-mail: [EMAIL PROTECTED] Web: http:\\ldsa.sbcld.sbc.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] FormBuilder linkNewValue issue
Hello, I'm posting here since I cannot find a proper list for FormBuilder. I have a big problem here: * I have a FB form with one linkNewValue linked table (PK on linked table points to FK on main table) * When there is an error in the main form, the linked new value in sub-form is inserted correctly in the DB, but the form is displayed again as nothing would happened in the sub form. * When I correct the main form and submit again, FB try to insert the sub-form values again and fails because DB constraints check for uniq in the linked table. I don't know if this is a bug or I did'nt understand how it works. Expected behaviour: there are two possibilities: 1 - kind of rollback on insertion of linked sub-forms when the main form fails 2 - set the sub-form hidden PK to the value of the last inserted row and set the main form linked field to the same value Any help would be higly appreciated. TIA -- Alessandro Pasotti ICQ# 245871392 Linux User #167502 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Multiselect List
That's not the problem. The problem is referring to the listbox via javascript. It doesn't like the format: formName.listBoxName[].value it has no problem with formName.listBoxName.value but then PHP doesn't seem to handle it correctly. Ryan From: Dimiter Ivanoff [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 18, 2005 12:25 PM To: Ryan Jameson (USA) Subject: Re: [PHP-DB] Multiselect List Place the countries in array. Name the select with your array name. select name=?=$yourarrayname? and for the option use as value the keys from the array.Where your keys may be the IDs of the countires from the db. Ryan Jameson (USA) [EMAIL PROTECTED] wrote: Hey Guys, I'm populating a multiselect list with countries from my database. PHP seems to require the name contain array brackets, ie. myName[]. The problem I'm having is referring to the select list via javascript when the name contains the brackets. Anyone know how? Thanks. Ryan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php How much free photo storage do you get? Store your holiday snaps for FREE with Yahoo! Photos. Get Yahoo! Photos http://us.rd.yahoo.com/mail/uk/taglines/default/photos/*http://uk.photo s.yahoo.com/ ** IMPORTANT NOTICE This communication is for the exclusive use of the intended recipient(s) named above. If you receive this communication in error, you should notify the sender by e-mail or by telephone (+44) 191 224 4461, delete it and destroy any copies of it. This communication may contain confidential information and material protected by copyright, design right or other intellectual property rights which are and shall remain the property of Piranha Studios Limited. Any form of distribution, copying or other unauthorised use of this communication or the information in it is strictly prohibited. Piranha Studios Limited asserts its rights in this communication and the information in it and reserves the right to take action against anyone who misuses it or the information in it. Piranha Studios Limited cannot accept any liability sustained as a result of software viruses and would recommend that you carry out your own virus checks before opening any attachment. GWAVAsigAdmID:BE763D12ECB94E65F0086E6453C6B30C ** IMPORTANT NOTICE This communication is for the exclusive use of the intended recipient(s) named above. If you receive this communication in error, you should notify the sender by e-mail or by telephone (+44) 191 224 4461, delete it and destroy any copies of it. This communication may contain confidential information and material protected by copyright, design right or other intellectual property rights which are and shall remain the property of Piranha Studios Limited. Any form of distribution, copying or other unauthorised use of this communication or the information in it is strictly prohibited. Piranha Studios Limited asserts its rights in this communication and the information in it and reserves the right to take action against anyone who misuses it or the information in it. Piranha Studios Limited cannot accept any liability sustained as a result of software viruses and would recommend that you carry out your own virus checks before opening any attachment. GWAVAsig -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Multiselect List
Ryan, you've had a couple of solutions that will work. The macromedia function, and the direct reference to the element - document.formName.elements['listBoxName[]']. For me the direct reference to the element is the most simple, and you can access the properties in the normal way e.g. document.formName.elements['listBoxName[]'].value Is there somethime more that you need?? hth... Dusty [EMAIL PROTECTED] wrote: That's not the problem. The problem is referring to the listbox via javascript. It doesn't like the format: formName.listBoxName[].value it has no problem with formName.listBoxName.value but then PHP doesn't seem to handle it correctly. Ryan snip -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Limiting Results
I am trying to limit results pulled from two tables, each with all states and congressional districts, to specified congressional districts. I want each college to appear once matched to each congressional district (that is in one table and is easy to do) and also include a column from a second table with the Representative. My syntax, below, produces far too many results, matching college and district and Representative many times. The syntax: select a.college, a.state, a.cd, b.rep from a, b where a.state = al and a.cd = 3 or a.state = az and a.cd = 1 and a.state = b.state and a.cd = b.cd What do I do to limit to single match for each college in the specified congressional districts? Ken -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Problems with interbase extension
Hello, I'm maintainer of databases/firebird port on FreeBSD, and I've splitted this port in two ports, firebird-client and firebird-server. To install php with interbase extension, the only dependency is firebird-client, and all builds fine, but, when I try to runa ibase_pconnect, the proccess stops and give me nothing, no error message, just don't run. My firebird-client port install libs (libfbembed, libgds, ligfbclient and libib_util) on /usr/local/lib and install *.h files on /usr/local/include. I don't think the problem is on PHP, but on my port and what and where I'm installing all the files. Does PHP need any more file? I'm going crazy finding eht problem and don't discover now... :-( Someone could help me to found what I missed to install or where I need to install the thing and back php wwith interbase works fine on FreeBSD? Any kind of help will be great. Thanks in advance -- Renato Botelho ICQ: 54596223 AIM: RBGargaBR -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Moving data from one MySQL table to another
I'm working on a web application and one of the things I am doing is creating an archiving function that would move older data to archive tables in order to minimise the amount of data in the active tables. This so that the data that is being used more frequently can be accessed faster by the users. My approach in building the archive function is: 1) SELECT query on the data 2) mysql_fetch_array to put the data into an array 3) INSERT subqueries to put the data into the archive tables. My concern is that in some cases, hundreds of rows of data would need to be moved - which could lead to awfully big arrays. However, the archiving function is likely to be used infrequently - not more than 1 or 2 times per week. This leads to two questions: 1) Could such a big array cause performance problems or worse? 2) Is there a better way? Many thanks, Jeff -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Limiting Results
You could always try the LIMIT keyword :) select a.college, a.state, a.cd http://a.cd/, b.rep from a, b where a.state = al and a.cd http://a.cd/ = 3 or a.state = az and a.cd http://a.cd/ = 1 and a.state = b.state and a.cd http://a.cd/ = b.cd http://b.cd/ LIMIT 50 -- Joseph Crawford Jr. Codebowl Solutions [EMAIL PROTECTED]
[PHP-DB] adodb is slow
hi all, I'm proud to install adodb library in my framework. I succesfully got it. But, surprise! My scripts became slower than ever! Exactly the 33% of the time is spent by adodb So, I know the advantages of this library, and I understand the reason is so slow...but, well, I wondered if somebody has reached a better results with adodb doing something with the library in performance. Well, thanks in advance. See you! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Limiting Results
I believe you need a main table where youn list all the colleges with columns for STATE, CONGRESSIONAL DISTRICT and REPRESENTATIVE. And those three columns would be pulled from three table catalogs: STATES, CONGRESSIONAL DISTRICTS and REPRESENTATIVES. Maybe there is a better approach, but I don't know the way your states or country is organized. Miguel -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Jueves, 19 de Mayo de 2005 07:13 a.m. To: php-db@lists.php.net Subject: [PHP-DB] Limiting Results I am trying to limit results pulled from two tables, each with all states and congressional districts, to specified congressional districts. I want each college to appear once matched to each congressional district (that is in one table and is easy to do) and also include a column from a second table with the Representative. My syntax, below, produces far too many results, matching college and district and Representative many times. The syntax: select a.college, a.state, a.cd, b.rep from a, b where a.state = al and a.cd = 3 or a.state = az and a.cd = 1 and a.state = b.state and a.cd = b.cd What do I do to limit to single match for each college in the specified congressional districts? Ken -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Moving data from one MySQL table to another
if the archive tables structures are identical and no processing needs to be done, why not use a 'select into table where ' and use the ids of the records to choose the ones that move? Bastien From: Jeffrey [EMAIL PROTECTED] To: php-db@lists.php.net Subject: [PHP-DB] Moving data from one MySQL table to another Date: Thu, 19 May 2005 15:19:48 +0200 I'm working on a web application and one of the things I am doing is creating an archiving function that would move older data to archive tables in order to minimise the amount of data in the active tables. This so that the data that is being used more frequently can be accessed faster by the users. My approach in building the archive function is: 1) SELECT query on the data 2) mysql_fetch_array to put the data into an array 3) INSERT subqueries to put the data into the archive tables. My concern is that in some cases, hundreds of rows of data would need to be moved - which could lead to awfully big arrays. However, the archiving function is likely to be used infrequently - not more than 1 or 2 times per week. This leads to two questions: 1) Could such a big array cause performance problems or worse? 2) Is there a better way? Many thanks, Jeff -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Problems with interbase extension
On 19/05/05, Renato Botelho [EMAIL PROTECTED] wrote: Hello, I'm maintainer of databases/firebird port on FreeBSD, and I've splitted this port in two ports, firebird-client and firebird-server. To install php with interbase extension, the only dependency is firebird-client, and all builds fine, but, when I try to runa ibase_pconnect, the proccess stops and give me nothing, no error message, just don't run. My firebird-client port install libs (libfbembed, libgds, ligfbclient and libib_util) on /usr/local/lib and install *.h files on /usr/local/include. I don't think the problem is on PHP, but on my port and what and where I'm installing all the files. Does PHP need any more file? I'm going crazy finding eht problem and don't discover now... :-( Someone could help me to found what I missed to install or where I need to install the thing and back php wwith interbase works fine on FreeBSD? Any kind of help will be great. I found the problem, I need to install firebird.conf with the client part, now all are working fine. Thanks anyway -- Renato Botelho ICQ: 54596223 AIM: RBGargaBR -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Moving data from one MySQL table to another
Try do that whit phpmyadmin. Regards, Luis Morales Bastien Koert wrote: if the archive tables structures are identical and no processing needs to be done, why not use a 'select into table where ' and use the ids of the records to choose the ones that move? Bastien From: Jeffrey [EMAIL PROTECTED] To: php-db@lists.php.net Subject: [PHP-DB] Moving data from one MySQL table to another Date: Thu, 19 May 2005 15:19:48 +0200 I'm working on a web application and one of the things I am doing is creating an archiving function that would move older data to archive tables in order to minimise the amount of data in the active tables. This so that the data that is being used more frequently can be accessed faster by the users. My approach in building the archive function is: 1) SELECT query on the data 2) mysql_fetch_array to put the data into an array 3) INSERT subqueries to put the data into the archive tables. My concern is that in some cases, hundreds of rows of data would need to be moved - which could lead to awfully big arrays. However, the archiving function is likely to be used infrequently - not more than 1 or 2 times per week. This leads to two questions: 1) Could such a big array cause performance problems or worse? 2) Is there a better way? Many thanks, Jeff -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] More problems with a script. How to I get to a next entry
HI All, I have this script. (See below) it was designed to allow my case managers to look at a list of the case noted they have generated on a specific client. It allows the case manager to select the client and then it shows them the case note. Only problem is that it only shows them one case note, and most of the clients will have several case notes that have been entered over the period of the program. Can anyone offer any suggestions. Keep the faith John html head titleWireless Neighborhoods/title /head ?php // Set the page title and include the HTML header. $page_title = 'Wireless Neighborhoods'; include_once ('include/header.html'); $db_connection = mysql_connect ('localhost', 'root', 'becky') or die (mysql_error()); $db_select = mysql_select_db('testDB') or die (mysql_error()); // Note: since ID id often used to indicate the autonumber record in a table, you may want to make the // client id field in the case_note table have the column name of 'client_id'. then you know where it came from $query = select ca.*, CONCAT(cl.fname, ', ', cl.lname) AS display_name from case_note ca inner join clients cl on clients.id = case_note.id; $result = mysql_query($result); if ($result mysql_num_rows($result)0) { $row = mysql_fetch_array($result); } ? font face=Verdana body bgcolor=#F0FFFD pfont size=5CTC Database Contact Log/font/p?php //Prints something like: Monday 15th of January 2003 05:51:38 AM echo date(l dS of F Y -- h:i:s A);//Prints something like: Monday the 15th ? fieldset table width=100% trtd width=30%Client Name:/tdtd?php $row['name'] ?/td/tr trtdContact Date: /tdtd ?php echo $row['date_added']; ? /td/tr trtdCase Manager: /tdtd ?php echo $row['cmanager']; ? /td/tr trtdPurpose of Contact: /tdtd ?php echo $row['purpose']; ? /td/tr trtdLocation of Contact:/tdtd ?php echo $row['location']; ? /td/tr trtdPresent at Contact: /tdtd ?php echo $row['present']; ? /td/tr trtdSubject:/tdtd ?php echo $row['subject']; ? /td/tr trtdNotes: /tdtd ?php echo $row['note']; ? /td/tr /table ?php include_once ('include/footer.html'); ? /body /html
RE: [PHP-DB] More problems with a script. How to I get to a next entry
you need to adjust the sql to remove some of the limiters in the where clause. ie remove the dates. Just join on the ids that should get you what you need... Bastien From: John R. Sims, Jr. [EMAIL PROTECTED] To: php-db@lists.php.net, php_mysql@yahoogroups.com Subject: [PHP-DB] More problems with a script. How to I get to a next entry Date: Thu, 19 May 2005 12:20:24 -0400 HI All, I have this script. (See below) it was designed to allow my case managers to look at a list of the case noted they have generated on a specific client. It allows the case manager to select the client and then it shows them the case note. Only problem is that it only shows them one case note, and most of the clients will have several case notes that have been entered over the period of the program. Can anyone offer any suggestions. Keep the faith John html head titleWireless Neighborhoods/title /head ?php // Set the page title and include the HTML header. $page_title = 'Wireless Neighborhoods'; include_once ('include/header.html'); $db_connection = mysql_connect ('localhost', 'root', 'becky') or die (mysql_error()); $db_select = mysql_select_db('testDB') or die (mysql_error()); // Note: since ID id often used to indicate the autonumber record in a table, you may want to make the // client id field in the case_note table have the column name of 'client_id'. then you know where it came from $query = select ca.*, CONCAT(cl.fname, ', ', cl.lname) AS display_name from case_note ca inner join clients cl on clients.id = case_note.id; $result = mysql_query($result); if ($result mysql_num_rows($result)0) { $row = mysql_fetch_array($result); } ? font face=Verdana body bgcolor=#F0FFFD pfont size=5CTC Database Contact Log/font/p?php //Prints something like: Monday 15th of January 2003 05:51:38 AM echo date(l dS of F Y -- h:i:s A);//Prints something like: Monday the 15th ? fieldset table width=100% trtd width=30%Client Name:/tdtd?php $row['name'] ?/td/tr trtdContact Date: /tdtd ?php echo $row['date_added']; ? /td/tr trtdCase Manager: /tdtd ?php echo $row['cmanager']; ? /td/tr trtdPurpose of Contact: /tdtd ?php echo $row['purpose']; ? /td/tr trtdLocation of Contact:/tdtd ?php echo $row['location']; ? /td/tr trtdPresent at Contact: /tdtd ?php echo $row['present']; ? /td/tr trtdSubject:/tdtd ?php echo $row['subject']; ? /td/tr trtdNotes: /tdtd ?php echo $row['note']; ? /td/tr /table ?php include_once ('include/footer.html'); ? /body /html -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Need help with a tricky query
I'm trying to write a query that pulls details on a game record, as well as the officials assigned to the game (up to 4 officials may be assigned to each game, but that's not always the case). Game details are in the games table, and assignments are in the games_referees table (which I alias as referee,ar1,ar2, and fourth). Ultimately, I want all the games for a given date, and the referees assigned to them. Below is the query I'm working with so far. In its current state, it returns results only when a full crew is assigned to the game (referee, ar1,ar2, fourth). The query is below: SELECT g. * , concat( ref.fname, ' ', ref.lname ) AS ref, concat( ar1.fname, ' ', ar1.lname ) AS ar1, concat( ar2.fname, ' ', ar2.lname ) AS ar2, concat( fourth.fname, ' ', fourth.lname ) AS fourth FROM ( ( ( ( ( ( ( ( games g RIGHT OUTER JOIN games_referees ref_ass ON ( g.id = ref_ass.gnum ) ) RIGHT OUTER JOIN people ref ON ( ref.login = ref_ass.referee ) ) RIGHT OUTER JOIN games_referees ar1_ass ON ( g.id = ar1_ass.gnum ) ) RIGHT OUTER JOIN people ar1 ON ( ar1.login = ar1_ass.referee ) ) RIGHT OUTER JOIN games_referees ar2_ass ON ( g.id = ar2_ass.gnum ) ) RIGHT OUTER JOIN people ar2 ON ( ar2.login = ar2_ass.referee ) ) RIGHT OUTER JOIN games_referees fourth_ass ON ( g.id = fourth_ass.gnum ) ) RIGHT OUTER JOIN people fourth ON ( fourth.login = fourth_ass.referee ) ) WHERE ref_ass.position =1 AND ar1_ass.position =2 AND ar2_ass.position =3 AND fourth_ass.position =4 AND g.date = '2004-09-25' Any help would be greatly appreciated. Thank -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php