Jump to content

Archived

This topic is now archived and is closed to further replies.

thechris

Need help displaying certain selection

Recommended Posts

Problem: I have the alphabetical navigation done and it displays and when I test this in a browser it will change the $Key in the URL field of the browser but what it won't do is just display the titles of the anime that start with the letter that is the key letter.

[code]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>iAnime Downloads</title>
<link href="Styles/basic.css" rel="stylesheet" type="text/css">
<link href="Styles/nav.css" rel="stylesheet" type="text/css">
<link href="Styles/menu.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.style2 {color: #FFFFFF}
-->
</style>
</head>

<body>
<div id="wrapper">
<div id="titlebar"><img src="Images/ban.png"></div>
<div id="nav">
<ul>
<li><a href="home.php">Home</a></li>
    <li><a href="downloads.php">Downloads</a></li>
    <li><a href="forum.php">Forums</a></li>
    <li><a href="support.php">Support</a></li>
    <li><a href="ianime.php">iAnime</a></li>
</ul>
</div>
<div id="top"><img src="Images/top.png"></div>
<div id="main content">
<div id="alphabet">
<?php
$Key = $_REQUEST['Key'];

if (!$Key) {
  $ASCII= 65; # uppercase (+32 for lowercase)
  $i = 1;
  while ($i < 27) {
    $Char = chr($ASCII);
    echo("<a href='?key=$Char'>$Char</a>");
    if($i < 26) {
    echo(" - ");
    }
    $i++;
    $ASCII++;
  }
} else {
  $SQL = sprintf("SELECT `anime_name` FROM `Videos` WHERE `anime_name` LIKE `%s*`", $Key);
}
?>
</div>
<div id="list"><center>
<?php require_once('Connections/connectDB.php'); ?>
<?php
mysql_select_db($database_connectDB, $connectDB);
$query_Recordset1 = "SELECT anime_name, type FROM Videos WHERE anime_name LIKE '$Key%' ORDER BY anime_name ASC";
$Recordset1 = mysql_query($query_Recordset1, $connectDB) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<br>
<table width="375" border="0">
  <tr bgcolor="#FF00FF">
    <td width="81"><span class="style2">Type</span></td>
    <td width="284"><span class="style2">Name</span></td>
  </tr>
  <?php do { ?>
  <tr>
      <td><?php echo $row_Recordset1['type']; ?></td>
      <td><?php echo $row_Recordset1['anime_name']; ?></td>
  </tr>
  <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
</table>

</center>
</div>
</div>
<div id="bottom">
<div id="word">
&copy; <?php echo date('Y'); ?>
</div>
</div>
</div>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>[/code]

Share this post


Link to post
Share on other sites
first of all your gonna need an ASCII Table to understand this, www.google.com/search?q=ascii+table

[code]
<?php
$Key = $_REQUEST['key'];

if (!$Key) {
  $ASCII= 65; # uppercase (+32 for lowercase)
  $i = 1;
  while ($i < 27) {
    $Char = chr($ASCII);
    echo("<a href='?key=$Char'>$Char</a>");
    $i++;
    $ASCII++;
  }
} else {
  $SQL = sprintf("SELECT `bla` FROM `blaTable` WHERE `bla` LIKE `%s*`", $Key);
  # pass $SQL to the database
}
?>
[/code]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.