0

hai....

there is thousands of products is there. now we want to see as a directory wise means (A-Z wise) devide. how to do this.

[B][U]A[/U][/B]

Apple
Ant
Aeroplane


[B][U]B[/U][/B]

Bat
Ball
Book

like this......up to z. how to do this?
adv thnks.

Edited by muralikalpana: n/a

3
Contributors
5
Replies
6
Views
7 Years
Discussion Span
Last Post by muralikalpana
0

hai....

there is thousands of products is there. now we want to see as a directory wise means (A-Z wise) devide. how to do this.

[B][U]A[/U][/B]

Apple
Ant
Aeroplane


[B][U]B[/U][/B]

Bat
Ball
Book

like this......up to z. how to do this?
adv thnks.

just write a query like this..

select * from table order by product

hope this will help u....

0

just write a query like this..

select * from table order by product

hope this will help u....

thanks for your reply.
i am not looking for above solution. i am looking for short script for this.

why because i am not displaying only two(A,B) directories.
i am displaying (A-z) directories. for that i will write 26 querys for each directory as you said. i am looking for short codes for this solution.
is there any solution to do this ?

0

what is the difference between these.

<?
for($i='A';$i<'Z';$i++)
{
echo $i;
//i will write select query using $i;
}
?>

above code displaying A to Y. its correct.
but below code displaying more.just see once. is it useful for my directory script which i was specified above.

<?
for($i='A';$i<='Z';$i++)
{
echo $i;
}
?>

see this one.

<?
for($i='A';$i<='Z';$i++)
{
echo $i; echo "<br>";
echo "write query here";echo "<br>";
if($i=='Z')
{
exit;
}
}
?>

up to here correct . but there is no products in the product which stats with 'V' i dont want to display the Directory.

Edited by muralikalpana: n/a

0

i think you are trying for this. hope this will help you.

at the top of the page you connect to your database.

<?
for($i='A';$i<='Z';$i++)
{
$select1=mysql_query("select * from product where productname like '$i%'");
$count=mysql_num_rows($select1);

if($count!=0)
{
echo $i; echo "<br>";
while($fetch=mysql_fetch_array($select1))
{
echo $fetch['productname']; echo "<br>";

} 
echo "<br>";

}
if($i=='Z')
{
exit;
}
}
?>
0

i think you are trying for this. hope this will help you.

at the top of the page you connect to your database.

<?
for($i='A';$i<='Z';$i++)
{
$select1=mysql_query("select * from product where productname like '$i%'");
$count=mysql_num_rows($select1);

if($count!=0)
{
echo $i; echo "<br>";
while($fetch=mysql_fetch_array($select1))
{
echo $fetch['productname']; echo "<br>";

} 
echo "<br>";

}
if($i=='Z')
{
exit;
}
}
?>

thanks pushpa.....i am trying for this only.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.