?
Solved

I need some help

Posted on 2003-03-25
3
Medium Priority
?
200 Views
Last Modified: 2008-03-06

Can someone please Help me to see what I am missing.

Here is the problem.

I want to list a collection of items.  Standard list.  Within that list I
want the selection of items that meet x criteria to be bolded and not to
have a checkbox.  I have that working fine, but its displaying the
collection list three times, instead of once.  I for the life of me cant
remember what I did yesterday.

http://www.heathermccullough.com/copelands/administration/new_store/build-d.php

thanks
0
Comment
Question by:iceman4272
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 9

Accepted Solution

by:
waygood earned 300 total points
ID: 8203447
Okay, I have seen the example and code and suggest the following:-


you are looping through the results from one query and then looping throught the results of another within that loop


include("config.php");
// get first list
$sql3 = "SELECT * FROM store_groups WHERE address_id = ".$aid."";  $result3 = mysql_query($sql3);
while ($row_array = mysql_fetch_array($result3))
{
  $group_list[]=$row_array;
}

// get second list
$collection_sql = "SELECT * FROM collections WHERE collection_id != '12' ORDER BY collection_id ASC";
$collection_result = mysql_query($collection_sql);
while ($collection_list = mysql_fetch_array($collection_result) )
{
   print "<TD BGCOLOR=\"#F7F7F7\" WIDTH=\"50%\">";
   // check if this value is in the first list we pulled earlier
   if(in_array($collection_list['collection_id'],$group_list)
   {
      print "<FONT FACE=\"Verdana, Arial, Tahoma\" SIZE=\"2\" COLOR=\"#000000\"><B>".$collection_list['collection_name']."</b></font>";
   }
   else
   {
      print "<FONT FACE=\"Verdana, Arial, Tahoma\" SIZE=\"1\" COLOR=\"#000000\"><input type=\"checkbox\" name=\"coll_id[]\" value=\"".$collection_list['collection_id']."\">".$collection_list['collection_name']."</b></font>";
   }    
   print "</td></tr>\n\r";
}
?>
<br/><br/>.......// rest here
0
 
LVL 9

Expert Comment

by:waygood
ID: 8203473
oops created a 2 dimensional array, change to this:

while ($row_array = mysql_fetch_array($result3))
{
 $group_list[]=$row_array['group_id'];
}
0
 

Author Comment

by:iceman4272
ID: 8203637
excellent thanks .. oh and just to add.

change:
if(in_array($collection_list['collection_id'],$group_list)

to:
if(in_array($collection_list['collection_id'],$group_list))
0

Featured Post

Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question