Logo 
Search:

C Programming Article

Submit Article
Comments on Program to print entered word in an alphabetical order

Program to print entered word in an alphabetical order


Sagar Rastogi
Sagar Rastogi from AustraliaJan 15
I want to make name asending order wise in $product = $globalClass->getRow("product","`id`='".$cat_id[$m]['prod_id']."' AND `status`='1'");
as i ahve used order by name asc not working

<?php

$cat_id = $globalClass->getRow("prod_category","`category`='".$get_cat['id']."'");

for($m = 0; $m<count($cat_id); $m++)

{

$product = $globalClass->getRow("product","`id`='".$cat_id[$m]['prod_id']."' AND `status`='1'");
if(!empty($product[0]['id']))
{
for($k=0; $k<count($product); $k++)

{



?>
get Row is a globalClass
function getRow($table,$condition)



{



$this->connection();



if(!empty($condition))



{



$query = mysql_query("SELECT * FROM `".$table."` where ".$condition) or die(mysql_error());



}



else



{



$query = mysql_query("SELECT * FROM `".$table."`") or die(mysql_error());



}



$id=0;



$multiRow = array(0);



if($row = mysql_fetch_assoc($query))



{



$i=0;



do



{



$multiRow[$i] = $row;



$i =$i+1;



}



while($row = mysql_fetch_assoc($query));



}



else



{



$multiRow = array(0);



}



return $multiRow;



}


Please enter your Comment
  • Comment should be atleast 15 Characters.
  • Please put code inside [Code] your code [/Code].