Jump to content

oldschool

Members
  • Posts

    15
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

oldschool's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. ok, this morning I've engaged my brain and got a step closer.. SELECT c.cat_name, c.cat_id, Count( m.msg_id ) AS CountOfMsg FROM communitymessages_subcats c, communitymessages m WHERE m.msg_sub_cat_id = c.cat_id AND c.cat_parent = '46' GROUP BY c.cat_name just for demostration purposes I've used a static value for cat_parent. I need to loop the above query for each cat_parent.. clues? sorry to keep bumping this, but I know it can be done, I just need a gentle nudge in the right direction.
  2. Just thought I'd bump incase somebody has a couple of minutes spare =]
  3. table1 id headline table2 id parent image Currently I've got SELECT a.headline, b.image FROM table1 a LEFT JOIN table2 b ON b.parent=a.id but what I want to do is list all the headlines from table 1 and display one image from table2 for each headline... Does anybody know where I'm going wrong here?
  4. I'm having to woes with my work at the moment. tbl_cats (cat_id, cat_name, cat_parent) -snip- 1 - Sales - NULL 2 - Wanted - NULL 3 - Announcments - NULL 4 - Household - 1 5 - Audio - 1 6 - Household - 2 7 - Household - 2 8 - Birthdays - 3 9 - Weddings - 3 -snip- Using the various tutorials around etc I've manged to list the categories under each parent vertically but I'd like to group them into columns like the design attached shows. Could somebody spare 5 minutes of guidence please? [attachment deleted by admin]
  5. [u][b]SQL Resources[/b][/u] [code]CREATE TABLE `tbl_attendance` (   `attn_enrol_id` int(11) NOT NULL,   `attn_id` int(11) NOT NULL auto_increment,   `attn_w1` tinyint(1) NOT NULL,   `attn_w2` tinyint(1) NOT NULL,   `attn_w3` tinyint(1) NOT NULL,   PRIMARY KEY  (`attn_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; CREATE TABLE `tbl_settings` (   `varName` varchar(255) NOT NULL,   `varValue` text NOT NULL,   `varDesc` text NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- Dump week settings. *other settings omitted* INSERT INTO `tbl_settings` (`varName`, `varValue`, `varDesc`) VALUES ('num_weeks', '3', ''), ('attn_w1', '2006-09-25', ''), ('attn_w2', '2006-10-02', ''), ('attn_w3', '2006-10-09', '');[/code] [b][u]Background Information[/u][/b] The number of week is completly dynamic. It can be changed on the fly by the user. The 'week' columns that are presented on the register need to be produced on the fly. [b][u]The Problem[/u][/b] I having difficuly producing the grid. The graphic below should help to understand. [img]http://dengate.amplifeyesolutions.com/example_grid.png[/img] I can't work out in my mind or on paper how to assign a appropiate name to each 1 or 0 (these will be checkboxes). Any tips/advice would be great Feel free to contact me via IM or Email :: danieldengate@amplifeye.com thanks guys Dan  ???
  6. Howdy! I'm trying to find out what the most sensible way is of keeping track of something I've just entered into a database is. For example... Page 1 - Enter details, hit submit. Data entered in to the database. Page 2 - Requires some of the data I've just entered to be displayed. I would prefer it if I could grab the record number that has just been created by the database, not the data that has been posted. Any pointers would be gratefully received. I'm thinking that I need to use a session, but just need some help to get out of the starting block. thanks Dan
  7. Thanks 'Wildbug'! Good way to start your post count! :)
  8. I want to list the manufactuers names where a product's sub_cat_id equals a particular value. I've tried lot of combinations of queries but none seem to work. The most recent below is an example. For example. [code]SELECT `tsav_products`.`product_manufacturer_id` FROM `tsav_products` WHERE `tsav_products`.`product_sub_cat_id` = 1[/code] Would give me a list of 1 1 5 I then want to match these to the manufacturers table, so displaying a list of manufactuers based on the products, but I do not want to have any manufacturer names to repeat, so for example, the two entries of '1' would only be displayed once. I've tried a number of different query with joins here there and everywhere but can't seem to crack it. Can anybody help me out here please? I've include a dump for anybody to test [code] -- -- Table structure for table `tsav_main_categories` -- CREATE TABLE `tsav_main_categories` (   `main_cat_id` int(11) NOT NULL auto_increment,   `main_cat_name` varchar(255) NOT NULL default '',   PRIMARY KEY  (`main_cat_id`) ) TYPE=MyISAM COMMENT='main categories' AUTO_INCREMENT=9; -- -- Dumping data for table `tsav_main_categories` -- INSERT INTO `tsav_main_categories` VALUES (1, 'Hi-Fi'); INSERT INTO `tsav_main_categories` VALUES (2, 'Home Cinema'); INSERT INTO `tsav_main_categories` VALUES (3, 'PA, DJ & Recording'); INSERT INTO `tsav_main_categories` VALUES (4, 'Musical Instruments'); INSERT INTO `tsav_main_categories` VALUES (5, 'Theatre & Stage Lighting'); INSERT INTO `tsav_main_categories` VALUES (6, 'Plasma, Projection and LCD'); -- -------------------------------------------------------- -- -- Table structure for table `tsav_manufacturers` -- CREATE TABLE `tsav_manufacturers` (   `manufacturer_id` int(11) NOT NULL auto_increment,   `manufacturer_name` varchar(255) NOT NULL default '',   PRIMARY KEY  (`manufacturer_id`) ) TYPE=MyISAM AUTO_INCREMENT=86; -- -- Dumping data for table `tsav_manufacturers` -- INSERT INTO `tsav_manufacturers` VALUES (9, 'Inca Designs    '); INSERT INTO `tsav_manufacturers` VALUES (10, 'Myryad    '); INSERT INTO `tsav_manufacturers` VALUES (12, 'Roksan    '); INSERT INTO `tsav_manufacturers` VALUES (13, 'Bandridge    '); INSERT INTO `tsav_manufacturers` VALUES (14, 'Chord    '); INSERT INTO `tsav_manufacturers` VALUES (15, 'Merlin Cables    '); INSERT INTO `tsav_manufacturers` VALUES (16, 'QED    '); INSERT INTO `tsav_manufacturers` VALUES (17, 'Van Den Hal    '); INSERT INTO `tsav_manufacturers` VALUES (19, 'Onkyo    '); INSERT INTO `tsav_manufacturers` VALUES (26, 'Pioneer    '); INSERT INTO `tsav_manufacturers` VALUES (27, 'Alphason Designs    '); INSERT INTO `tsav_manufacturers` VALUES (28, 'Arca    '); INSERT INTO `tsav_manufacturers` VALUES (29, 'Sound Organisation    '); INSERT INTO `tsav_manufacturers` VALUES (30, 'Sound Style    '); INSERT INTO `tsav_manufacturers` VALUES (32, 'Beyerdynamic    '); INSERT INTO `tsav_manufacturers` VALUES (33, 'Grado    '); INSERT INTO `tsav_manufacturers` VALUES (34, 'Sennheiser    '); INSERT INTO `tsav_manufacturers` VALUES (35, 'Isol-8    '); INSERT INTO `tsav_manufacturers` VALUES (36, 'Isotek    '); INSERT INTO `tsav_manufacturers` VALUES (38, 'Acoustic Energy    '); INSERT INTO `tsav_manufacturers` VALUES (43, 'MJ Acoustics    '); INSERT INTO `tsav_manufacturers` VALUES (45, 'Rel    '); INSERT INTO `tsav_manufacturers` VALUES (46, 'Sun Fire    '); INSERT INTO `tsav_manufacturers` VALUES (49, 'Audio Technica    '); INSERT INTO `tsav_manufacturers` VALUES (50, 'Goldring    '); INSERT INTO `tsav_manufacturers` VALUES (51, 'Michell Engineering    '); INSERT INTO `tsav_manufacturers` VALUES (52, 'Origin Live    '); INSERT INTO `tsav_manufacturers` VALUES (53, 'Project    '); INSERT INTO `tsav_manufacturers` VALUES (54, 'SME    '); INSERT INTO `tsav_manufacturers` VALUES (59, 'Arcam    '); INSERT INTO `tsav_manufacturers` VALUES (61, 'Finlux    '); INSERT INTO `tsav_manufacturers` VALUES (62, 'Lexicon    '); INSERT INTO `tsav_manufacturers` VALUES (64, 'Primare    '); INSERT INTO `tsav_manufacturers` VALUES (65, 'Teac    '); INSERT INTO `tsav_manufacturers` VALUES (70, 'Parasound    '); INSERT INTO `tsav_manufacturers` VALUES (73, 'Wharfedale    '); INSERT INTO `tsav_manufacturers` VALUES (77, 'Audio Pro    '); INSERT INTO `tsav_manufacturers` VALUES (78, 'Denon    '); INSERT INTO `tsav_manufacturers` VALUES (79, 'Quad    '); INSERT INTO `tsav_manufacturers` VALUES (82, 'Densen    '); INSERT INTO `tsav_manufacturers` VALUES (84, 'Definitive Technology    '); INSERT INTO `tsav_manufacturers` VALUES (85, 'Audiovector    '); -- -------------------------------------------------------- -- -- Table structure for table `tsav_products` -- CREATE TABLE `tsav_products` (   `product_id` int(11) NOT NULL auto_increment,   `product_sub_cat_id` int(11) NOT NULL default '0',   `product_manufacturer_id` int(11) NOT NULL default '0',   `product_name` varchar(255) NOT NULL default '',   PRIMARY KEY  (`product_id`) ) TYPE=MyISAM AUTO_INCREMENT=5; -- -- Dumping data for table `tsav_products` -- INSERT INTO `tsav_products` VALUES (1, 1, 1, 'arcam product 1'); INSERT INTO `tsav_products` VALUES (2, 1, 1, 'arcam product 2'); INSERT INTO `tsav_products` VALUES (3, 1, 5, 'sony product 1'); INSERT INTO `tsav_products` VALUES (4, 2, 4, 'phillips product 1'); -- -------------------------------------------------------- -- -- Table structure for table `tsav_sub_categories` -- CREATE TABLE `tsav_sub_categories` (   `sub_cat_id` int(11) NOT NULL auto_increment,   `sub_cat_name` varchar(255) NOT NULL default '',   `sub_main_cat` int(11) NOT NULL default '0',   PRIMARY KEY  (`sub_cat_id`) ) TYPE=MyISAM COMMENT='sub categories' AUTO_INCREMENT=21; -- -- Dumping data for table `tsav_sub_categories` -- INSERT INTO `tsav_sub_categories` VALUES (1, 'CD Player', 1); INSERT INTO `tsav_sub_categories` VALUES (2, 'Headphones & Media', 1); INSERT INTO `tsav_sub_categories` VALUES (3, 'Furniture', 1); INSERT INTO `tsav_sub_categories` VALUES (4, 'Mains Filtration', 1); INSERT INTO `tsav_sub_categories` VALUES (5, 'Turntables', 1); INSERT INTO `tsav_sub_categories` VALUES (6, 'Subwoofers', 2); INSERT INTO `tsav_sub_categories` VALUES (7, 'Styli', 0); INSERT INTO `tsav_sub_categories` VALUES (8, 'Amplification', 0); INSERT INTO `tsav_sub_categories` VALUES (10, 'Cassette Decks', 0); INSERT INTO `tsav_sub_categories` VALUES (11, 'DVD Players', 2); INSERT INTO `tsav_sub_categories` VALUES (12, 'Systems', 3); INSERT INTO `tsav_sub_categories` VALUES (13, 'Processing & Amplification', 3); INSERT INTO `tsav_sub_categories` VALUES (14, 'Speakers', 3); INSERT INTO `tsav_sub_categories` VALUES (15, 'Cables', 3); [/code]
  9. Your only running the insert query when there is an POST value, so therefore, move the query outside of the image POST
  10. [!--quoteo(post=371404:date=May 4 2006, 06:47 PM:name=phpORcaffine)--][div class=\'quotetop\']QUOTE(phpORcaffine @ May 4 2006, 06:47 PM) [snapback]371404[/snapback][/div][div class=\'quotemain\'][!--quotec--] Okay, It's no big news that you can use PHP's mail() method for sending SMS email's to devices like cell phones. When you strip away all the fluff all your really doing is "sending an email" which PHP has had the ability to do for quite some time now. What I am trying to do is, in the same sense as above, send to a QualComm unit (like what truck drivers have in semi trucks). I'm not thinking it is going to be as simple as an SMS message unless each unit is given an "email address" by Qualcomm. I know that my chances for a reply are slim to none given the specifics of this post - but it's worth a try. TIA [/quote] use the serial numbers of each box?
  11. Using following class [a href=\"http://www.phpclasses.org/browse/package/2181.html\" target=\"_blank\"]http://www.phpclasses.org/browse/package/2181.html[/a] and the issue begins here [code]foreach ($_FILES['my_field'] as $k => $l) {         foreach ($l as $i => $v) {             if (!array_key_exists($i, $files))                 $files[$i] = array();             $files[$i][$k] = $v;         }     } [/code] There is a total of two posts going to this array. I want to get the contents of each, and assign them to the following variables respectively [code] $g_tic $g_pos [/code] Can I have some tips please? The final two variables go to make up the contents of a query Thanks in advance :) D x
  12. to play, thank you very much sorry for taking so long to reply full credit added to script :)
  13. Thanks ^ Sorry, yes, it's MySQL How would I combine the above with this [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]SELECT DISTINCT MONTHNAME( gig_date ) AS MONTH FROM gigs WHERE (gig_date >= CURDATE( )) ORDER BY MONTH DESC[/quote] which will return the months listed in the database. So for example, the above currently lists April & May because the records contain dates in these months How can I attach each record(s) to each month?
  14. What's the most appropiate way of sorting the records in to Months. For example, we're in April, so results would appears as follows April 2006 [records] May 2006 [records] ... ... Decemeber 2006 [records] January 2007 [records] .... March 2007 [records] Thanks in advance for any help :)
×
×
  • 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.