Ask a Question related to PHP Development, Design and Development.
-
JR #1
Help With Code
Hello,
I have a import utility for a shopping cart, but for some reason on a
particular drop down box, it sorts randomly. Can someone look at the below
code and let me know what I missed to sort it alphabetically.
Thanks JR
<TD class='main' width='15%'>Categories:</TD>
<!--<TD><INPUT TYPE="TEXT" NAME="categories"></TD>-->
<?php
$cat_parents_sql="SELECT distinct(parent_id) FROM categories";
//put the parents in an array
$parents_array = $db->getAll($cat_parents_sql);
//now get a list of all the bottom level sub categories
$bottom_level_sql = "SELECT categories.categories_id,categories.parent_id,
categories_name
FROM categories, categories_description
WHERE categories.categories_id = categories_description.categories_id
AND categories.categories_id not in (";
foreach($parents_array as $parent_id){ $bottom_level_sql .=
$parent_id[0].','; }
$bottom_level_sql = rtrim($bottom_level_sql, ',');
$bottom_level_sql .= ") order by categories_name asc";
$bottom_level_query = $db->query($bottom_level_sql);
if (DB::iserror($bottom_level_query)){ die("'".$bottom_level_sql."'
".$bottom_level_query->getMessage()); }
?>
<TD><SELECT name="category">
<?php
while($bottom_level_query->fetchInto($bottom_level_row)){
$category_string = $bottom_level_row[2]." (".$bottom_level_row[0].")";
$parent = $bottom_level_row[1];
while($parent != 0){
$get_upper_category_sql = "SELECT
categories.categories_id,categories.parent_id,cate gories_name
FROM categories,categories_description
WHERE categories.categories_id = categories_description.categories_id
AND categories.categories_id = ".$parent." order by categories_name asc";
$get_upper_category_query = $db->query($get_upper_category_sql);
if (DB::iserror($get_upper_category_query)){
die("'".$get_upper_category_sql."'
".$get_upper_category_query->getMessage());
}
JR Guest
-
Why doesn't the Code Completion occur in FlexBuilder IDEwhen source code is in an external file?
I am seperating my .as from the MXML by using the following in my file.mxml: <mx:Script source="file.as"> When I edit file.as, the code... -
How would I include the Open Browser code into this lineof code?
Hello and thankyou in advance: I have an ASP page linked to my database and I want to apply the Open Browser behaviour to the code. I have tried... -
Custom control fires event but ignores some code in the code behind file
I do not quite understand the question. I will merely point out that most programming problems happen for a reason. Code works the way it is... -
Custom tool warning: DiscoCodeGenerator unable to initialize code generator. No code generated.
I created a brand new WebService (HelloWorld) and when I attempt to add this WebService to a WindowsForm project I get the following error message in... -
Security problem with Managed Code calling Unmanaged Code in a Web Page
Hello, I have a web page which contains an ActiveX control (unmanaged) and a Windows Forms User Control (managed). Both reside on a web page and...



Reply With Quote

