Forum Moderators: coopster

Message Too Old, No Replies

Showing results in online store which starts on certain alphabets

Showing results in php which starts in certain alphabets, HOW?

         

borisz

3:40 pm on Mar 14, 2011 (gmt 0)

10+ Year Member



Hi,

I need small help with showing results for brands in my online store that start with alphabets A, B,C, D, etc.... I have fallowing GET method and I need to know what should I change to make it show only results with specific alphabet if I e.g. set

Results.php?BrandLetter=A

here is php code I have now:

$colname_BrandsResults = "-1";
if (isset($_GET['BrandLetter'])) {
$colname_BrandsResults = $_GET['BrandLetter'];
}
mysql_select_db($database_coupons_database, $coupons_database);
$query_BrandsResults = sprintf("SELECT * FROM brands WHERE BrandLetter = %s ORDER BY BrandName ASC", GetSQLValueString($colname_BrandsResults, "text"));
$BrandsResults = mysql_query($query_BrandsResults, $coupons_database) or die(mysql_error());
$row_BrandsResults = mysql_fetch_assoc($BrandsResults);
$totalRows_BrandsResults = mysql_num_rows($BrandsResults);


so what changes I should do in above code so I can show results based on Results.php?BrandLetter=A . Again I need this for all alphabets. Hope you understand what Im trying to achieve. Thanks a lot!

coopster

8:19 pm on Mar 17, 2011 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Is your "BrandLetter" column a single character column? Is it a CHAR type field? You may need to enclose the value in the expression in quotation marks.