i've figured out that the string 0 is less than a.
I created a loop which list the titles in alphabetical order from A-Z.
My problem is that some of titles are numbered (ex: 8 1/2, 2001 A Space Odysee).
so i added an if/else statement to see if the letter was 'a' and if so, change the mysql_query to get those numbered titles, but for some reason its not working. I don't get any errors and the code runs, i just don't get the desired results.
what could be the problem?
here's the code:
<?php
require("Cart.php");
view_src_code($_SERVER['PHP_SELF']);
$alpha_listing = mysql_query("SELECT * from tblAlphabet", $dbServerConn);
while ($row = mysql_fetch_row($alpha_listing)){
$a_name = strtoupper($row[1]);
echo "<b><a href='#$a_name'>$a_name</a></b><br>";
}
echo "<p> </p>";
$alpha_list = mysql_query("SELECT * from tblAlphabet", $dbServerConn);
while ($row = mysql_fetch_row($alpha_list)){
$alpha_id = $row[0];
$alpha_name = strtoupper($row[1]);
echo "<b><a name='$alpha_name'>$alpha_name</a></b><br>";
//$test = mysql_query("SELECT left(Items.ItemName,1) FROM Items");
// my problem is here in these statements.
if ($row[0] == 1){
$item_name = mysql_query("SELECT * FROM Items WHERE left(Items.ItemName,1) <= '$alpha_name' ", $dbServerConn);
}
else{
$item_name = mysql_query("SELECT * FROM Items WHERE left(Items.ItemName,1) = '$alpha_name' ", $dbServerConn);
}
//$item_genre = mysql_query("SELECT * FROM Items WHERE FIND_IN_SET('$alpha_id',genre)", $dbServerConn);
while($row2 = mysql_fetch_row($item_name)){
//$avail = $row2[7];
if($row2[7] == 1){
echo "*<a href='http://www.librarymedia.org/order/dvd_title.php?itemID=$row2[6]'>$row2[1]</a><br>";
}
else{
echo "* $row2[1]<br>";
}
}
}
here's a running example of this code:
http://www.librarymedia.org/order/dvd_great_movies.php