Results 1 to 5 of 5

Thread: Make a search in a mysql table.

  1. #1
    Join Date
    Apr 2008
    Location
    Little Office!
    Posts
    80
    Thanks
    15
    Thanked 0 Times in 0 Posts

    Default Make a search in a mysql table.

    well,

    i am looking for very simple help for creating a search in a mysql table.

    well,

    we already have the search searching two other tables but now we need to include this one as well.

    i am attaching the two file which are used for searching the two tables and here is the info about the third table.

    Code:
    -- phpMyAdmin SQL Dump
    -- version 3.2.4
    -- http://www.phpmyadmin.net
    --
    -- Host: localhost
    -- Generation Time: Jun 18, 2010 at 12:30 PM
    -- Server version: 5.0.90
    -- PHP Version: 5.2.6
    
    SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
    
    
    -- --------------------------------------------------------
    
    --
    -- Table structure for table `ap_element_options`
    --
    
    CREATE TABLE IF NOT EXISTS `ap_element_options` (
      `aeo_id` int(11) NOT NULL auto_increment,
      `form_id` int(11) NOT NULL default '0',
      `element_id` int(11) NOT NULL default '0',
      `option_id` int(11) NOT NULL default '0',
      `position` int(11) NOT NULL default '0',
      `option` text,
      `option_is_default` int(11) NOT NULL default '0',
      `live` int(11) NOT NULL default '1',
      PRIMARY KEY  (`aeo_id`)
    ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=161 ;
    
    --
    -- Dumping data for table `ap_element_options`
    --
    
    INSERT INTO `ap_element_options` (`aeo_id`, `form_id`, `element_id`, `option_id`, `position`, `option`, `option_is_default`, `live`) VALUES
    (10, 1, 14, 1, 1, 'Directors of early childhood programs', 0, 1),
    (11, 1, 14, 2, 2, 'Family/group family child care providers', 0, 1),
    (12, 1, 14, 3, 3, 'Teaching staff in early childhood programs', 0, 1),
    (13, 1, 14, 4, 4, 'Those providing infant care', 0, 1),
    (14, 1, 14, 5, 5, 'Those providing preschool care', 0, 1),
    (15, 1, 14, 6, 6, 'Those providing school-age care', 0, 1),
    (16, 1, 14, 7, 7, 'Business leaders', 0, 1),
    (17, 1, 14, 8, 8, 'Staff in other social service and/or family support programs', 0, 1),
    (18, 1, 14, 9, 9, 'Researchers', 0, 1),
    (19, 1, 14, 10, 10, 'Home visitors', 0, 1),
    (20, 1, 14, 11, 11, 'Advocates', 0, 1),
    (21, 1, 14, 12, 12, 'Parents/Families', 0, 1),
    (24, 1, 14, 15, 13, 'Government officials', 0, 1),
    (26, 1, 15, 1, 1, 'Physical-sensory-motor development', 0, 1),
    (27, 1, 15, 2, 2, 'Social-emotional development', 0, 1),
    (28, 1, 15, 3, 3, 'Cognitive-intellectual development', 0, 1),
    (29, 1, 15, 4, 4, 'Communication among children and adults', 0, 1),
    (30, 1, 15, 5, 5, 'Behavior management', 0, 1),
    (31, 1, 15, 6, 6, 'Child temperament', 0, 1),
    (32, 1, 15, 7, 7, 'Family support', 0, 1),
    (33, 1, 15, 8, 8, 'Play and child development', 0, 1),
    (35, 1, 16, 1, 1, 'Classroom arrangement', 0, 1),
    (36, 1, 16, 2, 2, 'Classroom management', 0, 1),
    (37, 1, 16, 3, 3, 'Outdoor play environment', 0, 1),
    (38, 1, 16, 4, 4, 'The importance of play', 0, 1),
    (39, 1, 16, 5, 5, 'School readiness', 0, 1),
    (40, 1, 16, 6, 6, 'Medication Administration Training', 0, 1),
    (41, 1, 16, 7, 7, 'Interacting with and exploring materials', 0, 1),
    (42, 1, 16, 8, 8, 'Encouraging decision-making', 0, 1),
    (43, 1, 16, 9, 9, 'Respecting cultural diversity', 0, 0),
    (44, 1, 16, 10, 10, 'Language', 0, 1),
    (45, 1, 16, 11, 11, 'Early literacy', 0, 1),
    (46, 1, 16, 12, 12, 'Arts', 0, 1),
    (47, 1, 16, 13, 13, 'Science', 0, 1),
    (48, 1, 16, 14, 14, 'Technology', 0, 1),
    (49, 1, 16, 15, 15, 'Mathematics', 0, 1),
    (50, 1, 16, 16, 16, 'Social sciences', 0, 1),
    (51, 1, 16, 17, 17, 'Health and physical education', 0, 1),
    (52, 1, 16, 18, 18, 'Life skills', 0, 1),
    (53, 1, 16, 19, 19, 'Development of critical thinking skills', 0, 1),
    (54, 1, 16, 20, 20, 'Inclusion of children with special needs', 0, 1),
    (56, 1, 17, 1, 1, 'Fostering continuity between home and program environments', 0, 1),
    (57, 1, 17, 2, 2, 'Increasing family involvement', 0, 1),
    (58, 1, 17, 3, 3, 'Stress management', 0, 1),
    (59, 1, 17, 4, 4, 'Educational experiences in child''s home language', 0, 1),
    (60, 1, 17, 5, 5, 'Culturally sensitive programming', 0, 1),
    (61, 1, 17, 6, 6, 'Abuse and neglect', 0, 1),
    (62, 1, 17, 7, 7, 'Home visiting', 0, 1),
    (63, 1, 17, 8, 8, 'Parent leadership', 0, 1),
    (64, 1, 17, 9, 9, 'Advocating for your child', 0, 1),
    (66, 1, 18, 1, 1, 'Child observations', 0, 1),
    (67, 1, 18, 2, 2, 'Reviewing samples of children''s work', 0, 1),
    (68, 1, 18, 3, 3, 'Use of formal, standardized assessment instruments', 0, 1),
    (69, 1, 18, 4, 4, 'Analysis of decision-making based on assessment information', 0, 1),
    (71, 1, 19, 1, 1, 'Effective staff communication', 0, 1),
    (72, 1, 19, 2, 2, 'Effective communication with children', 0, 1),
    (73, 1, 19, 3, 3, 'Effective communication with families', 0, 1),
    (118, 1, 34, 4, 4, 'Professional code of ethics', 0, 1),
    (117, 1, 34, 3, 3, 'Public policy advocacy', 0, 1),
    (116, 1, 34, 2, 2, 'Program assessment tools, e.g., ECERS, ITERS, NAEYC accreditation', 0, 1),
    (115, 1, 34, 1, 1, 'Legal and regulatory guidelines', 0, 1),
    (114, 1, 19, 5, 4, 'Effective communication with community', 0, 1),
    (113, 1, 19, 4, 5, 'others', 0, 0),
    (109, 1, 31, 1, 1, 'Yes', 0, 1),
    (110, 1, 31, 2, 2, 'No', 0, 1),
    (119, 1, 34, 5, 5, 'Hiring and firing of staff', 0, 1),
    (120, 1, 34, 6, 6, 'Staff development', 0, 1),
    (121, 1, 34, 7, 7, 'Organizational diversity', 0, 1),
    (122, 1, 34, 8, 8, 'How to use classroom observation instruments', 0, 1),
    (123, 1, 34, 9, 9, 'Program management', 0, 1),
    (124, 1, 34, 10, 10, 'Financial management', 0, 1),
    (125, 1, 34, 11, 11, 'Stress management', 0, 1),
    (129, 1, 16, 21, 9, 'Respecting cultural diversity', 0, 1),
    (127, 1, 35, 1, 1, 'Yes', 0, 1),
    (128, 1, 35, 2, 2, 'No', 0, 1),
    (155, 1, 31, 3, 3, 'Maybe', 0, 1),
    (156, 1, 16, 22, 21, 'Early brain development', 0, 1),
    (157, 1, 16, 23, 22, 'Outdoor/Nature Education', 0, 1),
    (158, 1, 16, 24, 23, 'Transitions', 0, 1),
    (159, 1, 17, 10, 10, 'Impact and Use of Media', 0, 1);

    attached is the file which searches the rest of the DB.

    thanks.

  2. #2
    Join Date
    Jan 2007
    Location
    Davenport, Iowa
    Posts
    2,089
    Thanks
    96
    Thanked 98 Times in 96 Posts

    Default

    That is a lot of info to go through and I'd rather not go through it all. Try to post only the query. The table data may be important, but not now. Most importantly what is it that you are trying to do? Do you have a question?

    Some of us have a fair amount of experience with creating dynamic database searches, but despite all of the code you posted it is unclear what it is exactly that you are trying to do.

    After a cursory glance at the attached file I would say that it is overly complicated and in need of a few loops to slim it down. It depends on your needs, but I suggest you look into making it dynamic as well.

    The file has a number of included files and functions which are not described. If you are trying to create another search identical to the first two you created I imagine that wouldn't be too hard for you to do.
    To choose the lesser of two evils is still to choose evil. My personal site

  3. The Following User Says Thank You to james438 For This Useful Post:

    chetanmadaan (06-20-2010)

  4. #3
    Join Date
    Apr 2008
    Location
    Little Office!
    Posts
    80
    Thanks
    15
    Thanked 0 Times in 0 Posts

    Default

    James,

    thanks for the very descriptive reply...
    Let me explain the situation here now.

    the search file you see above was created by a programmer who is no longer working with me. the problem is that he did the job about 98% and left 2% incomplete.

    the table i am referring two contains the the form elements data.

    i.e. 1. Children and Kids.
    2. Old and Gold.
    3.....
    so and so...

    he made a seach to the results table and the problem is that table doesn't contain this data and instead of this it contains just the numbers... like for children and kids it contains 1 and so and so.

    Let me know if this does makes a sense

  5. #4
    Join Date
    Jan 2007
    Location
    Davenport, Iowa
    Posts
    2,089
    Thanks
    96
    Thanked 98 Times in 96 Posts

    Default

    I don't plan on working on this project. What you are asking requires a lot of time and effort. There is a lot more to this project than what you think. If I were to work on it I would need to look at all of the include files as well as the two you already listed. Functions is an aspect of php I never mastered, which is certainly a problem as well.

    My suggestion is to start over from scratch. I am sure that idea does not sound too appealing to you with a script that is 98% done, but to start over is actually easier than trying to finish what your friend wrote unless you are familiar with his work or the code.
    To choose the lesser of two evils is still to choose evil. My personal site

  6. #5
    Join Date
    Apr 2008
    Location
    Little Office!
    Posts
    80
    Thanks
    15
    Thanked 0 Times in 0 Posts

    Default

    alright... no problem at all.

    Thanks once again for all your efforts

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •