php - sort mysql array / or append to existing -


i looping through mysql object containing orders. 1 order can contain multiple items/products.

the data looks this using sql query

select order_.id, order_.name, order_.phone, order_rule.product_id, order_rule.amount order_ inner join order_rule on order_.id = order_rule.order_id 

i use jquery accordion display orders. looks this.

the problem have try can't add multiple product items single order within <h3> </h3> ( seperates 1 order another) element.

the code have looks this.

while($row = mysql_fetch_array($retval)){  if(!in_array($row["id"], $idarray)){    echo "<h3><b>".$row["name"]."</b> ".$row["phone"]."</h3><div  class=".$row["id"]."><p>".$row["amount"]."x ".getproductnamebyid($row["product_id"])." </p></div>";    array_push($idarray, $row["id"]);  }else{   // append row existing div  } } 

i tried echo <script>$(.".$row["id"].").append(".$row["product_details".); </script>

which doesn't work, because reasons add empty order.

i tried doing while loop after first 1 ended, reason wont loop twice on same object. empties array if try again.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -