Jump to content

Organisation Help


RJT

Recommended Posts

In my add data form, there is a category option. Im trying to make a series of pages that will list the appropriate data for each category ($category). For Example if the category was "TNA" then it would only list the data that was given that category in the add data form. For some reason i get an error message when i use this code. Could anyone point out where the problem is?

[code]
<?php include('http://www.reef-break.com/cawcenter/header.php') ?>

<?
include("dbinfo.inc.php");
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM caws ORDER BY name WHERE category='TNA'";
$result=mysql_query($query);

$num=mysql_fetch_array( $result );

mysql_close();

echo "<b><center>Viewing All CAWs ($num)</center></b><br>";

?>

<?
$i=0;
$first_letter_old="";
while ($i < $num) {
    $name=mysql_result($result,$i,"name");
    $category=mysql_result($result,$i,"category");
    $first_letter=substr($name,0,1);
    if (($first_letter!=$first_letter_old)&&($first_letter_old!="")){
        echo "<br />";
    }
    $first_letter_old=$first_letter;
    ++$i;
    echo "<a href='http://www.reef-break.com/cawcenter/svr2006/caw.php?name=$name'>$name</a><br>";
}

?>

<?php include('http://www.reef-break.com/cawcenter/footer.php') ?>
[/code]

Thanks.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.