Jump to content

Omzy

Members
  • Posts

    314
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Omzy's Achievements

Regular Member

Regular Member (3/5)

0

Reputation

  1. I fixed this using: session_cache_limiter('private_no_expire, must-revalidate');
  2. Hi, I need a preg_match for the following criteria: - no leading or trailing white space allowed - only alphanumeric characters and spaces are allowed (no full stops, commas apostrophe's, explanation marks, quotes, etc) - only one space allowed between each word (if there is more than one word) Thanks.
  3. I have a HTML dropdown list which is populated from a MySQL table. I use an auto-incremend ID field. I have also got a sort_order field. I would like to be able to specify the exact order that entries should appear in the dropdown list. Specifically I need some functionality that does the following two things: 1) If I change the sort order of a record to for example "4" then the existing record with sort_order 4 becomes 5, sort_order 5 becomes 6 and so on. 2) If I change the sort order of a record to for example "4" and there is currently no record with sort_order 4, then no other records will be updated.
  4. public function getEventTypes() { return array( 1=>array('Exhibition', 1), 2=>array('Wedding', 1), 3=>array('Business', 1), 4=>array('School Trip', 0), 5=>array('Birthday', 0), 6=>array('Concert', 1), 7=>array('Sporting Event', 1), 8=>array('Training', 0), 9=>array('Conference', 1), 10=>array('Other', 1), ); } I now want to generate a new array from this array as follows: 1) must retain the existing key 2) must be single dimensional and the value of each element will be value[0] 3) must only contain the array elements where value[1] = 1 So for example the generated array should be as follows: public function getActiveEventTypes() { return array( 1=>'Exhibition', 2=>'Wedding', 3=>'Business', 6=>'Concert', 7=>'Sporting Event', 9=>'Conference', 10=>'Other', ); }
  5. OK I've tried this, the thing is that the explode() function creates an array with it's own numerical indexes and that makes it more difficult to format the data. I put the data in to a string ($towns) and then did the following: $townarray=explode(",", $towns); $townstring=implode(",", $townarray); $newtownarray=explode("=", $townstring); foreach($newtownarray as $key=>$value) { echo $value; echo "\n"; } I think there is obviously an error in this and I can't figure out how to do it..
  6. I've got some data which I need to populate into a database. Currently it is the following form: East Kilbride = 10, Ellesmere Port = 1, Worksop = 6, Worthing = 4, Wrexham = 11, Yeovil = 3, York = 8, (that is just a sample of the data, there are about 400 rows) So it's basically like a key & value format, I can of course do a find&replace on the equals symbol to get the => operator and convert the data in to an array, but the main diffculty is to get the keys/values enclosed in single quotes. The idea is to build an mysql insert statement so that I can input all the data in to one of the tables. How would I go about doing this?
  7. Basically I construct the SQL query based on what fields need updating. If the user only needs to update one field then there isn't much sense in overwriting all the other fields with the same data. Unless you know of a more elegant way to achieve the same behaviour?
  8. Sorry I should have been more clear - there is one checkbox per field (5 fields in total).
  9. I have a form with some input fields; all fields are disabled by default, so this means those fields do not get posted unless a tickbox is ticked to enable them. Also in the form is a hidden field "userid". I want to check if "userid" is the ONLY field in the $_POST array - if yes then I can just redisplay the form.
  10. I currently use the following rule to rewrite .php to .htm RewriteRule ^(.*)\.htm$ $1.php I now want to change this so that it rewrites .php to .html, but also add another rule to redirect any existing .htm urls to .html (must be a search engine friendly/301 redirect).
  11. I like jQuery, but one thing I don't like is the vast CSS library included with it. There's so many styles that are overriding parent styles and so on. I like to keep my CSS as simple as possible and although splitting up CSS is good practice, I don't particularly like the idea of applying so many different classes to an element or overriding styles more than once. The thing with jQuery is that all the components share a 'base' css file (jquery.ui.theme.css). This file has shared styles such as .ui-widget and .ui-state-default. The problem I'm having is that if I want to style an individual component I inevitably have to modify one of the shared styles, which subsequently affects other components. How can I, for example tell jQuery Tabs to use ONLY css property ID #tabs instead of using the classes "ui-tabs ui-widget ui-widget-content ui-corner-all"?
  12. Hi there and thanks! Yes I should have mentioned, there are multiple main categories! I just wanted to reduce the code and have only one loop to be honest.
  13. Here is my multi-dimensional array: $subcats=array( 'lighting-effects'=>array( 'light-shows'=>array('Light Shows', 'Wedding Light Shows'), 'sound-systems'=>array('Sound Systems', 'Wedding Sound Systems'), 'visual-displays'=>array('Visual Displays', 'Wedding Visual Displays'), 'fireworks-pyrotechnics'=>array('Fireworks/Pyrotechnics', 'Wedding Fireworks/Pyrotechnics'), 'star-cloths'=>array('Star Cloths', 'Wedding Star Cloths'), 'mist-generators'=>array('Mist Generators', 'Wedding Mist Generators'), 'virtual-flames'=>array('Virtual Flames', 'Wedding Virtual Flames'), 'confetti-canons'=>array('Confetti Cannons', 'Wedding Confetti Cannons'), ), ); I want to run a foreach loop on the 'lighting-effects' array keys (light-shows, sound-systems, etc). Currently I do it like this: foreach($subcats as $index1 => $value1) { foreach($value1 as $index2 => $value2) { // processing here } } But I'm wondering if this is a long winded way of doing it/is there a quicker way?
  14. Thanks mjdamato. So now how do I go about outputting the data to my requirements?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.