[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.8

PHP / MySQL problem

Asked by lamerhooDJV in PHP Scripting Language

I'm having a query problem with my SQL.   Basically the problem I'm having right now is, I store the cateogry types in the category_type table and then in the static_page_permission table I connect the category_type and the customer_type table together like the following:

insert into static_page_permission VALUES('1', 'customer_type', '2');
Which would link food (from category_type) and Customer (customer_type) to the static_page_permission table.



Let's say for category_type:
1 food YES
2 salad YES
3 fruit YES
4 gardens YES

customer_type:
1 Customer Active
2 Affiliate Active

--

DROP TABLE IF EXISTS `category_types`;
CREATE TABLE `category_types` (
  `id` int(11) NOT NULL auto_increment,
  `name` varchar(155) NOT NULL default '',
  `login` enum('yes','no') NOT NULL default 'yes',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

DROP TABLE IF EXISTS `customer_type`;
CREATE TABLE  `customer_type` (
  `customer_typeid` int(11) NOT NULL auto_increment,
  `type_name` varchar(128) NOT NULL default '',
  `status` enum('Active','Inactive') NOT NULL default 'Active',
  PRIMARY KEY  (`customer_typeid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

DROP TABLE IF EXISTS `static_page_permission`;
CREATE TABLE `static_page_permission` (
  `typeid` int(11) NOT NULL default '0',
  `table_name` varchar(25) NOT NULL default '',
  `table_type` int(11) NOT NULL default '0',
  KEY `typeid` (`typeid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

--

Ultimately, I need a way to query this and put it into checkboxes with a way to pass variables to say whether or not it is checked or not.  I wrote a funciton that somewhat does that.  Please help!  If you have an easier way for me to retrieve this, by all means, let me know!

function page_list_customer_types($ids = null)
{
      $output = NULL;
      // Sorting
      @asort($ids);
      $q = mysql_query("select * from customer_type where status='Active'");
      for($i = 0; $row = mysql_fetch_assoc($q); ++$i) {
            $checked = ($ids[$i] == $row['customer_typeid']) ? "CHECKED" : "";
            $output .= "<input ".$checked." type=\"checkbox\" name=\"cust_type_".$i."\" value=\"".$row['customer_typeid']."\">".$row['type_name']."<br />";
      }
      return $output;
}

// $ids is an array of the selected values... but that seems to not be working properly.  Please help :)

Jacob
[+][-]10/17/06 01:11 AM, ID: 17745550Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zone: PHP Scripting Language
Sign Up Now!
Solution Provided By: CyberGhost
Participating Experts: 1
Solution Grade: A
 
[+][-]11/09/06 12:39 PM, ID: 17909256Administrative Comment

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 30-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]11/14/06 07:42 PM, ID: 17943801Administrative Comment

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 30-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091118-EE-VQP-93