What I'm trying to do is make a search function for a list of a lot of products. The way the products work is that each product has a product_parent and a product_index the product_parent saves information about the product itself, and product_index saves the "sku" for the products , and when calling for all the procuts I use this code:
<script>
$(function() {
var availableTags = ['DISCOUNT;;Discount',
<?php
$get_con2 = mysql_query("SELECT * FROM `product_parents`");
$conarr2 = array();
while($con2 = mysql_fetch_array($get_con2)){
array_push($conarr2,$con2['id']);
}
$get_con = mysql_query("SELECT * FROM `product_childs` WHERE `parent_id` IN (".implode(',',$conarr2).")");
$conarr = array();
while($con = mysql_fetch_array($get_con)){
array_push($conarr,$con['index_id']);
}
$showall = "WHERE `id` IN (".implode(",",$conarr).")";
$get_prods = mysql_query("SELECT * FROM `product_index`".$showall);
$get_brand = mysql_query("SELECT product_parents.supplier, suppliers.id, suppliers.name FROM product_parents WHERE LEFT JOIN suppliers ON suppliers.id=product_parents.supplier");
$get_prodname = mysql_query("SELECT product_parents.name FROM product_parents");
$js = "";
while($prods = mysql_fetch_array($get_prods)){
$prodbrand = mysql_fetch_array($get_brand);
$prodname = mysql_fetch_array($get_prodname);
/* $js .= "'". addslashes($prodbrand['name'])."". addslashes($prodname['name'])." (".indexStock($prods['id'])." on stock);;".addslashes($prods['sku'])."',"; */
/* $js .= "'".addslashes($prods['sku']).";; ". addslashes($prods['name'])." (".indexStock($prods['id'])." on stock)',"; */
$js .= "'".addslashes($prodbrand['name'])."',";
/* $js .= "'".addslashes($prodbrand['name'])." ".addslashes($prodname['name']).";; ". addslashes($prods['name'])." (".indexStock($prods['id'])." on stock)',"; */
} echo substr($js,0,-1);
?>
];
$( "#add_row_sku" ).autocomplete({
source: availableTags
});
});
</script>
and it's showing a bunch of results, but not all of them, however when I run the query in phpmyadmin it results every result I am trying to have it show. also, when I use:
/* $js .= "'".addslashes($prods['sku']).";; ". addslashes($prods['name'])." (".indexStock($prods['id'])." on stock)',"; */
it shows things just fine, can anyone see what I'm doing wrong here? I've been stuck for hours. also if you are willing to help but don't quite understand what I'm asking, I'll be happy to add you on skype or whatever so you can further assist me and that would be greatly appreciated!