473,396 Members | 1,864 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Display results from a - z

142 100+
Hi,

How do I display the row results from a-z?

Example:

Select a category - a b c d e f g .... And if the user click b, then all the products starting with be is displayed?

Thanks


[PHP]
<?php
$con = mysql_connect("localhost","****","****");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}

mysql_select_db("gamehunt_co_za_store", $con);

$result = mysql_query("SELECT * FROM products_description ORDER BY products_name");

while($row = mysql_fetch_array($result))
{
echo "<a href=\"$row[products_url]\">$row[products_name]</a>";
echo "<br />";
}mysql_close($con);
?>
[/PHP]
Feb 23 '08 #1
2 1333
I think you kept the categories in a separate table and product descriptions in a separate table. if that is the case you could use a join query to select the records and filtering out the category which you selected by using the
category like "$category_letter%".
Feb 23 '08 #2
Markus
6,050 Expert 4TB
use WHERE
So, if you have your data stored in the table and also a column name which has the catagory theyre in (a, b, c, d...)
[php]
$_c = $_GET['letter']; // remember to sanatise this.
SELECT * FROM `table_name` WHERE `catagory` = '{$_c}'";
[/php]
Hope this helps!
Feb 23 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: erica | last post by:
Hi, I am currently writing PHP code for some polling software. When someone votes, it stores their IP address in the database. From then on, they cannot vote in that particular poll, they only...
6
by: Jules | last post by:
Hi: I have an Access 97 Search form set up - a couple of combo boxes, a couple of text fields and a command button. I want the command button to run an SQL script and then open the results form....
2
by: ayasofya | last post by:
Hi..i'm very new to thic C++ programming..in doing my assignment i face some difficulties..first 1) i use 2 dimension of array e.g," 1 columns and 5 numbers under each column"...and i ask the user...
5
by: PHPBABY3 | last post by:
Hi, 1. I have two SQL tables. I will call them employees and departments: EMP: LAST_NAME, FIRST_NAME, DEPTNM DEPT: NUM, NAME Input: text string FIND Output: the LAST_NAME, FIRST_NAME...
4
by: murrayatuptowngallery | last post by:
I started a JS project (my first) a year or two ago, got distracted & am just now getting back to it. By luck I had somehow found a way to collect data with a form, perform calculations with...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.