Advertisement

09.30.2008 at 07:56AM PDT, ID: 23774816 | Points: 500
[x]
Attachment Details

Errorwith multiple array and while loop

Asked by wilson1000 in PHP and Databases

Tags:

This question is in relation to my original, unsolved problem...

The question is located here -> http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/PHP_Databases/Q_23772078.html?cid=239#a22600195

After some testing, I have narrowed the problem down to a discrepancy with an additional 'while' statement i'm using to populate an array, this array is listing product category values returned from a product record set.

Can anyone shine some light on this subject and offer a suitable solution please - source code can be found below.

If you need more information than I have provided, please ask. Thank youStart Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
<?php
$maxRows_qhwd_products = 5;
$pageNum_qhwd_products = 0;
if (isset($_GET['pageNum_qhwd_products'])) {
  $pageNum_qhwd_products = $_GET['pageNum_qhwd_products'];
}
$startRow_qhwd_products = $pageNum_qhwd_products * $maxRows_qhwd_products;
 
mysql_select_db($database_connHWD, $connHWD);
$query_qhwd_products = "SELECT * FROM hwd_products ORDER BY prpr ASC";
setQueryBuilderSource($query_qhwd_products,$WADbSearch1,false);
$query_limit_qhwd_products = sprintf("%s LIMIT %d, %d", $query_qhwd_products, $startRow_qhwd_products, $maxRows_qhwd_products);
$qhwd_products = mysql_query($query_limit_qhwd_products, $connHWD) or die(mysql_error());
$row_qhwd_products = mysql_fetch_assoc($qhwd_products);
$to_t = array();
$to_t[]=$row_qhwd_products;
 
if (isset($_GET['totalRows_qhwd_products'])) {
  $totalRows_qhwd_products = $_GET['totalRows_qhwd_products'];
} else {
  $all_qhwd_products = mysql_query($query_qhwd_products);
  $totalRows_qhwd_products = mysql_num_rows($all_qhwd_products);
}
$totalPages_qhwd_products = ceil($totalRows_qhwd_products/$maxRows_qhwd_products)-1;
 
 
 
//***********************************************************************************************
 
 
while ($row_qhwd_products = mysql_fetch_array($qhwd_products)) {
                $to_t[] = $row_qhwd_products['prcaid'];
}
if ((!in_array(1,$to_t))&&(in_array(2,$to_t))) {
        $ticl = "";
        $tite = "Improvement Packages";
}elseif ((in_array(1,$to_t))&&(!in_array(2,$to_t))) {
        $ticl = "class=\"webApp\"";
        $tite = "Website Applications &amp; eCommerce";
}else{
        $ticl = "class=\"prodServ\"";
        $tite = "Products &amp; Services";
}
 
 
 
//********************************************************************************************
 
 
<!-- html -->
 
 
<?php do { ?>
                <tr>
                  <td><div class="WADAResultsEntry"><div class="WADAResultThumbArea"><a href="prod_d.php?prid=<?php echo(rawurlencode($row_qhwd_products['prid'])); ?>" title="<?php echo $row_qhwd_products["prna"]; ?>"><img class="WADAResultThumb" border="0" src="../assets/images/products/<?php echo $row_qhwd_products["prim"]; ?>" alt="<?php echo $row_qhwd_products["prna"]; ?>" /></a></div>
                      <div class="WADAResultInfoArea">
                        <div class="WADAResultTitle"><a href="prod_d.php?prid=<?php echo(rawurlencode($row_qhwd_products['prid'])); ?>"><?php echo $row_qhwd_products["prna"]; ?></a></div>
                        <div class="WADAResultDescription"><?php echo $row_qhwd_products["prsa"]; ?> <a href="prod_d.php?prid=<?php echo(rawurlencode($row_qhwd_products['prid'])); ?>">More...</a></div>
                        <div class="WADAResultCommerceArea">
                          <div class="WADAResultCommerceButton">
                            <form name="hwd_uk_1_ATC_<?php echo $row_qhwd_products["prid"]; ?>" method="POST" action="<?php echo $_SERVER["PHP_SELF"]; ?><?php echo (isset($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] != "")?"?".$_SERVER["QUERY_STRING"]:""; ?>">
                              <input type="hidden" name="hwd_uk_1_ID_Add" value="<?php echo $row_qhwd_products["prid"]; ?>" >
                              <input name="hwd_uk_1_Quantity_Add" type="text" id="cartInput" value="1" size="4" maxlength="2" >
                              <input type="image" src="../WA_eCart/Images/Slate/Btn2_EN_purchase_small.gif" border="0" value="Add to Cart" name="hwd_uk_1_ATC">
                            </form>
                            </div>
                          <div class="WADAResultPrice">&pound; <?php echo $row_qhwd_products["prpr"]; ?></div>
                          <div class="WADAClearRight"></div>
                        </div>
                      </div></div></td>
                </tr>
<?php } while ($row_qhwd_products = mysql_fetch_assoc($qhwd_products)); ?>
[+][-]09.30.2008 at 08:04AM PDT, ID: 22606031

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

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

 
[+][-]09.30.2008 at 08:37AM PDT, ID: 22606387

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

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

 
[+][-]09.30.2008 at 09:18AM PDT, ID: 22606860

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

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

 
[+][-]09.30.2008 at 09:31AM PDT, ID: 22607016

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

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

 
[+][-]09.30.2008 at 01:59PM PDT, ID: 22609411

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

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

 
[+][-]10.01.2008 at 08:22AM PDT, ID: 22615341

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

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

 
 
Loading Advertisement...
20081112-EE-VQP-44 - Hierarchy / EE_QW_2_20070628