Re: [PHP] Select all that contains in MySql
Try: $query = SELECT * FROM software_assets WHERE $searchType LIKE '$search%' ; Note the percent sign, this is equivalent to a wildcard (* for instance). On Thu, 2003-04-03 at 10:53, Mike Tuller wrote: I have built a search function that searches a table for all items that match what you enter into the search field. I would like it to return all items that contain a certain string rather that matches. For example, I want to have it so that if I enter M in the search field, it will return all items that start with M. Here is what I have so far. $query = SELECT * FROM software_assets WHERE $searchType LIKE '$search' ; Thanks, Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Adam Voigt ([EMAIL PROTECTED]) Linux/Unix Network Administrator The Cryptocomm Group My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] 'Select All'
Hi Martin, Excellent, thanks for your help :) Regards -- Shane On Monday 17 Dec 2001 10:15 pm, Martin Towell wrote: you _can_ reference it by name - try this: script function my_select(type) { frm = document.forms.test; ele = frm[mycheckbox[]]; len = ele.length; for (i = 0; i len; i++) ele[i].checked = type; } /script form name=test input type=button value=All onClick=my_select(true); input type=button value=None onClick=my_select(false); input type=checkbox name=mycheckbox[] input type=checkbox name=mycheckbox[] input type=checkbox name=mycheckbox[] input type=checkbox name=mycheckbox[] /form Martin -Original Message- From: Shane Wright [mailto:[EMAIL PROTECTED]] Sent: Tuesday, December 18, 2001 4:55 AM To: [EMAIL PROTECTED] Subject: [PHP] 'Select All' Hi I'm having somewhat of a problem :( I have my banks of checkboxes, all named 'mycheckbox[]' with the values as different IDs. The user happily checks a few of them and my scripts happily process the resulting arrays. But... how do I get Javascript to do a 'select all' on them?? I cant access them by name because of the square brackets, and I cant access them by going through all form elements in case there are other checkboxes that dont want to be included. Is there a tidy way around this, does any of the above make sense? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] 'Select All'
Shane, is this meant for initial settings of the form only or as a button, or some such, to allow someone to select all the boxs? chuck - Original Message - From: Shane Wright [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, December 17, 2001 6:54 PM Subject: [PHP] 'Select All' Hi I'm having somewhat of a problem :( I have my banks of checkboxes, all named 'mycheckbox[]' with the values as different IDs. The user happily checks a few of them and my scripts happily process the resulting arrays. But... how do I get Javascript to do a 'select all' on them?? I cant access them by name because of the square brackets, and I cant access them by going through all form elements in case there are other checkboxes that dont want to be included. Is there a tidy way around this, does any of the above make sense? Thanks -- Shane -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] 'Select All'
I know *exactly* what you mean, the solution (took me at least an hour) is attached. have fun, bvr. On Mon, 17 Dec 2001 17:54:42 +, Shane Wright wrote: Hi I'm having somewhat of a problem :( I have my banks of checkboxes, all named 'mycheckbox[]' with the values as different IDs. The user happily checks a few of them and my scripts happily process the resulting arrays. But... how do I get Javascript to do a 'select all' on them?? I cant access them by name because of the square brackets, and I cant access them by going through all form elements in case there are other checkboxes that dont want to be included. Is there a tidy way around this, does any of the above make sense? Thanks -- Shane -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] 'Select All'
Hi Charles, As a button, ideally two in fact - 'select all' and 'unselect all'. I've done it easily with ASP sites - where the '[]' is not required to have the values passed back as an array. (I know I could find a non-array way of doing it but its a pain) -- Shane On Monday 17 Dec 2001 6:06 pm, Charles Williams wrote: Shane, is this meant for initial settings of the form only or as a button, or some such, to allow someone to select all the boxs? chuck - Original Message - From: Shane Wright [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, December 17, 2001 6:54 PM Subject: [PHP] 'Select All' Hi I'm having somewhat of a problem :( I have my banks of checkboxes, all named 'mycheckbox[]' with the values as different IDs. The user happily checks a few of them and my scripts happily process the resulting arrays. But... how do I get Javascript to do a 'select all' on them?? I cant access them by name because of the square brackets, and I cant access them by going through all form elements in case there are other checkboxes that dont want to be included. Is there a tidy way around this, does any of the above make sense? Thanks -- Shane -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] 'Select All'
Oh, one more thing.. The latest MSIE suddenly doesn't seem to support the function to be named 'selection' . change that and it'll work ;) bvr. I know *exactly* what you mean, the solution (took me at least an hour) is attached. have fun, bvr. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] 'Select All'
you _can_ reference it by name - try this: script function my_select(type) { frm = document.forms.test; ele = frm[mycheckbox[]]; len = ele.length; for (i = 0; i len; i++) ele[i].checked = type; } /script form name=test input type=button value=All onClick=my_select(true); input type=button value=None onClick=my_select(false); input type=checkbox name=mycheckbox[] input type=checkbox name=mycheckbox[] input type=checkbox name=mycheckbox[] input type=checkbox name=mycheckbox[] /form Martin -Original Message- From: Shane Wright [mailto:[EMAIL PROTECTED]] Sent: Tuesday, December 18, 2001 4:55 AM To: [EMAIL PROTECTED] Subject: [PHP] 'Select All' Hi I'm having somewhat of a problem :( I have my banks of checkboxes, all named 'mycheckbox[]' with the values as different IDs. The user happily checks a few of them and my scripts happily process the resulting arrays. But... how do I get Javascript to do a 'select all' on them?? I cant access them by name because of the square brackets, and I cant access them by going through all form elements in case there are other checkboxes that dont want to be included. Is there a tidy way around this, does any of the above make sense? Thanks -- Shane -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]