?
Solved

I need some help

Posted on 2003-03-25
3
Medium Priority
?
214 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
  • 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
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

571 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