RE: [PHP-DB] checkboxes and loops
I am relatively new with PHP, but have done this many times with ASP. First, I would not assign the counter value to the checkbox as you are now. Use the ID (identity) value from the database for the applicant record instead. Since ONLY the checkboxes that are checked will be submitted, you can just loop through the submitted checkbox values and perform a 'delete', or 'whatever' on each submitted record. Or, use: ...WHERE IN (id1, id2, ..., idN) in your DELETE statement. Duane -Original Message- From: matthew perry [mailto:[EMAIL PROTECTED] Sent: Sunday, March 28, 2004 11:45 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] checkboxes and loops OK lets see if I can figure out how to ask this: I am setting up a system for my company to filter through employee applications. Most of the applications do not fit the criteria and I want to allow my bosses a checkbox to the right of them which they can check or uncheck to remove an applicant. So I run a loop that generates a bunch of check boxes with the name box1, box2, box3... by running a loop that runs this and increments counter every time: { input type = checkbox name = box?echo $counter;? value = delete $counter++; } But when I try to create my query that updates the table I have a problem generating these variable again by referring to them indirectly: *Bad solution 1 (to much work)*** if ($box1 == 'delete') do whatever if ($box2 == 'delete') do whatever if ($box3 == 'delete') do whatever if ($box4 == 'delete') do whatever if ($box5 == 'delete') do whatever if ($box6 == 'delete') do whatever *** *Bad solution 2 (doesn't work)*** $counter = 1; while (whatever) { if ($box . $counter == 'delete') do whatever $counter++; } *** How do I get around this problem? Hopefully someone understands what I am trying to say. Matt -- 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] Windows XP and PHP
I installed Apache/Perl/PHP onto a Windows XP machine today and ran into this problem when I tried to access the MS SQL Server via PHP: can't load dynamic library php_mssql.dll The dll is in the extensions directory. Apache is running fine. Any ideas, on what might be wrong? I think this is in the php documentation but here is an answer from: http://forums.devshed.com/archive/5/2002/11/2/47028 = MSSQL connection using PHP (ERROR) micros_bytes This is happening because you do not have the required MS-SQL client libraries. In addition to having the PHP extension DLL, you have to have the Microsoft DLLs for accessing SQL Server. I don't recall the exact files but you can get them by installing the SQL Server Client Tools from the SQL Server install CD. Once you have that installed, you should be able to connect without errors. = -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Windows XP and PHP
I had this bookmarked too, and I had forgotten about it. Would installing the MDAC Microsoft have on their site install the ntwdblib.dll? Don't think so, I have current MDAC installed and it is not on my ws. I just found this on: http://www.php.net/function.mssql-connect GET ntwdblib.dll This dll can also be found in the binary zip of php 4.3 in the dlls subdir. put it in the system32 dir. WATCH OUT... i used a copy found on a MSSQL server, used that.. couldn't get it to work.. My function calls seamed OK, could call the mssql routines but I got a connection error When I used the dll distributed with the binary zip of php 4.3 it worked. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Windows XP and PHP
I had this bookmarked too, and I had forgotten about it. Would installing the MDAC Microsoft have on their site install the ntwdblib.dll? I just checked php-4.3.4-WIN32.zip and ntwdblib.dll is in there. Drop it in your extensions directory and make sure the line: extension=php_mssql.dll ... in the ;Windows Extensions section of php.ini is uncommented. Verify your - extension_dir = path - setting also. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Unable to connect to MSSQL with PHP through a firewall
I came across this problem when I separated my web applications and database (sql 2000) onto separate servers. The problem is that Windows does not (cannot) pass user authentication information to SQL server ... if they are different machines. I used Mixed authentication and added user accounts/groups to sql server to authenticate at the database. Unfortunately, Windows doesn't support this when IIS and SQL servers reside on separate machines. My understanding is that it will work in native AD environment using Kerberos delegation, but I have no way to test/validate that. Change your connection to use SQL authentication and you will be able to connect to SQL just fine. Your connectionstring should look something like this: PROVIDER=SQLOLEDB.1; Persist Security Info=False; Data Source=ip or servername; Initial Catalog=database; UID=sql_login; PWD=password Give the sql login the necessary rights to do what the application needs to do. hth, Duane www.ciber.com -Original Message- From: Ricky Boone [mailto:[EMAIL PROTECTED] Sent: Thursday, January 29, 2004 7:24 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Unable to connect to MSSQL with PHP through a firewall I've got an odd little problem that I just can't figure out. First, let me briefly describe my setup: * Behind a firewall is a Windows 2003 Server running SQL Server 2000 with mixed mode authentication * On that same internal network is a Linux web server with Apache 2, PHP 4.3.4, FreeTDS, etc. * The firewall is setup to only allow the external web servers access to specific NAT forwarded ports (1433 TCP, 1434 UDP, 445 TCP) * At a colocation ISP is another web server running Windows 2000 Server with Apache 2, PHP 4.3.3, etc. I've written a script that connects to the SQL server for simple authentication and tracking. This script was developed on the internal Linux box. Everything works fine on this server: connecting, authenticating, queries, etc.. Running the same script on the external Windows box isn't working as well, though. Apache and PHP run just fine on this box with other scripts, but connecting to the SQL server through the firewall with the same script and settings, except for the IP address of the server (since we are connecting to the firewall's NAT'd ports), but I consistantly receive the following error: Login failed for user 'JoeShmoe'. Reason: Not associated with a trusted SQL Server connection. I'm thinking either there is a problem with the SQL server's settings (somewhere, I don't know), or PHP on the external webserver, but I'm not sure what to do. I've looked all over the configurations for both servers and they look fine, checked several sites and lists for advice and couldn't find anything that would work. Any ideas as to what I should be looking for? -- Ricky Boone [EMAIL PROTECTED] Planetfurry.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
RE: [PHP-DB] php-db Forms-Radio problems
It appears the intention of the text input is to provide an other job type. Instead of removing it, rename it to job_other or something. Then test for the value of job, if other use job_other value. -Original Message- From: Stuart [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 27, 2004 11:42 AM To: Mignon Hunter Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DB] php-db Forms-Radio problems Mignon Hunter wrote: input type=radio name=job value=oper Operation Maintenance input type=radio name=job value=eng Engineering (Including Project Management) input type=radio name=job value=mgmt Management (other than corporate) input type=radio name=job value=other Other - Please Specify input name=job type=text size=30 This last field will overwrite the radio setting when PHP reads the form fields. Remove it. It's not needed. -- Stuart -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Another question
You can avoid the prompt when using javascript to close the window if you use this: function closeit(){ window.opener = top; window.close(); } Now, window will close without prompting. hth, Duane -Original Message- From: Constantin Brinzoi [mailto:[EMAIL PROTECTED] Sent: Monday, December 15, 2003 6:15 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Another question Is there a php function that closes a browser window? I know there is a javascript function (window.close), but I can't use it because it complains that the window is not opened by javascript (window.open). I looked over the function reference but I didn't find anything about this problem. TIA Constantin Brinzoi -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Another question
In I.E. 5.5 and newer. -Original Message- From: Mike U. Petrov [mailto:[EMAIL PROTECTED] Sent: Monday, December 15, 2003 7:32 AM To: [EMAIL PROTECTED]; 'Constantin Brinzoi'; [EMAIL PROTECTED] Subject: RE: [PHP-DB] Another question I've tried to use this function, but it doesn't work on IE 5.0 On Opera 7.21 it works. So on what browser you've tested it? Mike U. Petrov -Original Message- From: Duane Lakoduk [mailto:[EMAIL PROTECTED] Sent: Monday, December 15, 2003 4:18 PM To: 'Constantin Brinzoi'; [EMAIL PROTECTED] Subject: RE: [PHP-DB] Another question You can avoid the prompt when using javascript to close the window if you use this: function closeit(){ window.opener = top; window.close(); } Now, window will close without prompting. hth, Duane -Original Message- From: Constantin Brinzoi [mailto:[EMAIL PROTECTED] Sent: Monday, December 15, 2003 6:15 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Another question Is there a php function that closes a browser window? I know there is a javascript function (window.close), but I can't use it because it complains that the window is not opened by javascript (window.open). I looked over the function reference but I didn't find anything about this problem. TIA Constantin Brinzoi -- 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] Another question
This works because you have assigned a name to the .opener property which is blank when you open a browser without script. Script is now satisfied that window was opened by script. -Original Message- From: Muhammed Mamedov [mailto:[EMAIL PROTECTED] Sent: Monday, December 15, 2003 7:26 AM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Another question Really? What is the reason for that?... Muhammed. - Original Message - From: Duane Lakoduk [EMAIL PROTECTED] To: 'Constantin Brinzoi' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Monday, December 15, 2003 3:17 PM Subject: RE: [PHP-DB] Another question You can avoid the prompt when using javascript to close the window if you use this: function closeit(){ window.opener = top; window.close(); } Now, window will close without prompting. hth, Duane -Original Message- From: Constantin Brinzoi [mailto:[EMAIL PROTECTED] Sent: Monday, December 15, 2003 6:15 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Another question Is there a php function that closes a browser window? I know there is a javascript function (window.close), but I can't use it because it complains that the window is not opened by javascript (window.open). I looked over the function reference but I didn't find anything about this problem. TIA Constantin Brinzoi -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.545 / Virus Database: 339 - Release Date: 27.11.2003 -- 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] Saving state
From: Shiloh Madsen [mailto:[EMAIL PROTECTED] Sorry about the cross posting, as im not exactly sure what would be the best method to handle this, but im trying to set up a web application with a tabbed interface. Each tab will have a form to enter data, and the requisite save and continue button. Heres where things get hard though. I want to be able to allow users to click on a previous tab to refrence, change, update, etc the information on those tabs. How do i save the state of these tabs so that they can be reaccessed? Just so you have a little more information, im trying to make a kinda simple call logging system with a customer tab which would hold customer info and a calls tab which would store call info and allow you to switch between call records. all of this data would be stored in a database, but i dont want to actually have to send a new query to the database just because the user clicked on a previous tab...if this would be possible. Also, if anyone has an idea as to how i can implement this a bit more intelligently, im open to suggestions, but the tabbed interface seemed to be the most user friendly. And yes, the web interface is important, which is why im not trying to do it in c++ or something like that. Shiloh I have done this using multiple hidden div tables /div. Works well for large forms when you want to show only a small piece of it at a time. Each tab exposes the current div table and hides the remaining tables. No need to save state because all data is on one form. It is just hidden from view until you get to the final tab and submit. If you are using any drop-downs select tags, you will need to set their visibility to 'none' along with that table because of their inherent visibilty over all other html. I have also seen this done using successive forms, posting one form to the next and creating hidden fields to save the data from one form to the next. This might be hard to handle though if you want to move forward and backward at will. Duane -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Saving state
Luke, Good point, this list is set up different in that Reply ONLY replies to the individual poster, not the list. Have to use reply to all. I have added the list address to this post. To all concerned, this thread contains some off list conversation that may be of interest, particularly to the original poster. Luke, I agree, both methods will probably work well, as you said, 'depending on the situation'. To expand on the issue of retrieving previously posted data into a multi-tabbed form. In this case, I would normally show the user a list of previous posts or perform a search. Selecting a previous post would load the form with the historical data to allow reviewing one tab at a time. Just like loading any normal edit/view form, but with the tabs breaking up the form into individual parts of the same record. Edits and updates are performed and posted using a similar process to the original post but using an UPDATE WHERE instead of an INSERT INTO statement. List, Sorry if this post is ugly. Delete as necessary. -Original Message- From: Luke Skywalker [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 16, 2003 9:19 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Saving state Yeah, i got ya, totally different concept, i was thinking the tabs would be like |previous calls|add a call|statistics| (just an example) but i now know what you mean with hiding/showing the sections thats a good idea if its only for submitting, but what if they want to go to a previous calls tab (like i have there) all the previously submitted calls wont be still held in the form data and i havent used any query strings in my example, to pass the values from each form id use the form post and submit it with javascript, so all the values (including the hidden ones) are available through $_POST['hiddenfieldname'] I think we have two different concepts entirely, i think yours would work, and mine would work, depending on the circumstances :) Maybe we should be posting this thread to the mailing list? Luke - Original Message - From: Duane Lakoduk [EMAIL PROTECTED] To: 'Luke Skywalker' [EMAIL PROTECTED] Sent: Wednesday, September 17, 2003 12:04 PM Subject: RE: [PHP-DB] Saving state Yes, I think so. Are you using the querystring to pass the name=value pairs for each form? If so, you could run into a querystring length problem if the form is large. Let me know if I got this part right. The method that uses the tabbed form never posts the data until you are completely done filling all tabs. These are not different pages, I am using DHTML to hide each successive tab. Simply hiding that tab form data and exposing the next. Completing the part of the form on each tab, then click submit only when completed on all tabs. Note: each tab is only a part of the complete form. The form data is only submitted once all tabs (parts of the form) are complete. Make sense? Duane -Original Message- From: Luke Skywalker [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 16, 2003 8:52 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Saving state Yeah, i think i understand what you mean, the one form used on each different page, but Shiloh would have to transfer the information from page to page, and what would happen if a user wanted to click from tab to tab the tabs at the top of teh page (or side or wherever) would not be forms, so the information wouldnt be submitted to them, and hed have to requery to get the information back? but if the javascript code submits the information to the next page (and that javascript code can be assigned to any hyperlink, thus effectively turning any link into a submit button) do you know what i mean? and yeah it is strange that you havent seen your post yet, it has been sent to the list, as i saw it there :/ Luke - Original Message - From: Duane Lakoduk [EMAIL PROTECTED] To: 'Luke Skywalker' [EMAIL PROTECTED] Sent: Wednesday, September 17, 2003 11:43 AM Subject: RE: [PHP-DB] Saving state Luke, I think you may have this out of sequence. I was replying to Shiloh's post. I commented on the hidden field process as well. I use that for some other forms and info pulled from Exchange or the Account SAM database. I like the tabbed approach as it is just one form regardless of the number of tabs. Really have to look at these on a case by case basis. On another note, I haven't even gotten my own post to the forum yet that you are replying to. Odd huh? Thanks -Original Message- From: Luke Skywalker [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 16, 2003 8:27 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Saving state Just something to keep in mind, if your users
RE: [PHP-DB] Breaking down a table field....
I think you may already have this, but just another 20 pesos SELECT Unit, COUNT(Unit) [Quantity] FROM table GROUP BY Unit -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, August 07, 2003 8:52 AM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Breaking down a table field Next question How can I show how many of each there were? SO now I have breafast lunch dinner I want to have breafast2 lunch 3 dinner 3 etc... is that just as easy? [EMAIL PROTECTED] 07/08/2003 14:42 To: [EMAIL PROTECTED] cc: [EMAIL PROTECTED] Subject:Re: [PHP-DB] Breaking down a table field SELECT DISTINCT(Unit) from TABLE_NAME; [EMAIL PROTECTED] sungard.com To: [EMAIL PROTECTED] cc: 08/07/2003 09:37 AM Subject: [PHP-DB] Breaking down a table field I have a table, wth many entries. Each entry has been asigned a unit to belong to. I want to list all the units dynamically. How can I display all the units, without displaying each instance of the unit? EG: Unititem breakfast cereal breakfast toast lunch salad lunch sandwich dinner steak dinner pie lunch soup dinner lasagne and so on.. I'd wanna get a list of: breafast lunch dinner not several instances of each... how can I do this? * The information contained in this e-mail message is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. *** -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php * The information contained in this e-mail message is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. *** -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Form Actions in PHP
Don't know if this got answered yet. I usually do this by checking the variable before submitting the form and then adjusting the form action. It turns out to be a JavaScript problem. if(variable==a){ document.form.action=location_one.cgi; }else if(var==b){ document.form.action=location_two.cgi; }else{ document.form.action=location_default.cgi; } If you need to, or prefer to, check it on the server-side, then you can a create a form with hidden fields in the first post to hold all the post data, and then check the variable, then perform a second post using the onload method to post to the correct program as required. hth, Duane -Original Message- From: Rick Dahl [mailto:[EMAIL PROTECTED] Sent: Friday, July 18, 2003 10:18 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Form Actions in PHP I have a small problem. I need to have a form post to two different locations. If a variable is a certain value, it goes to location_one.cgi and if it is another value, it goes to location_two.cgi. This may turn out be a html problem but I figured php was the way to go since it is more dynamic. Any help is appreciated. - Rick -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php