Jump to content

RJT

New Members
  • Posts

    8
  • Joined

  • Last visited

    Never

Posts posted by RJT

  1. [b]Full Code[/b]
    [code]<?php include('header.php') ?>

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

    $num=mysql_numrows($result);

    mysql_close();


    ?>
    <center>
    <table align="center" max-width="480" width="480" cellpadding="2" cellspacing="0" border="1" bordercolor="#000000">
          <tr>
          <td width=480 background="images/backgrounds/menubg.jpg" align="center"><font face="verdana" color="#FF0000" size="2"><b>
    Viewing All Wrestlers (<?php echo "$num" ?>)
          </td>
          </tr>

          <tr>

          <td bgcolor="333333" valign="top" width="480" align="left">
          <font face="verdana" size="2" color=black>
    <table width='480'>
    <?
    $i=0;
    $first_letter_old="";
    while ($i < $num) {
        $name=mysql_result($result,$i,"name");
        $image=mysql_result($result,$i,"image");
        ++$i;
    echo "<td bgcolor=000000 valign='top' width='100' align='left'><center><a href='wrestler.php?name=$name'><img border=0 width=100 src='http://www.reef-break.com/scw/images/superstars/$image.jpg'></a><br><font face=verdana size=1 color=red><a href='wrestler.php?name=$name'>$name</a></font></center></td>"; }
    ?>
    </table>
    </td>
    </tr>
    </table>

    <?php include('footer.php') ?>[/code]

    [b]Main Bit of Code that needs editing[/b]
    [code]<?
    $i=0;
    $first_letter_old="";
    while ($i < $num) {
        $name=mysql_result($result,$i,"name");
        $image=mysql_result($result,$i,"image");
        ++$i;
    echo "<td bgcolor=000000 valign='top' width='100' align='left'><center><a href='wrestler.php?name=$name'><img border=0 width=100 src='http://www.reef-break.com/scw/images/superstars/$image.jpg'></a><br><font face=verdana size=1 color=red><a href='wrestler.php?name=$name'>$name</a></font></center></td>"; }
    ?>[/code]


    I need to somehow make the code make a < br> after 5 <td> rows are printed so the maximum amount of rows is 5. I currently have no idea how to do this, so help would be appreciated.  :)
  2. 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.
  3. Thanks alot for that jwo :). For some reason though the first record of the next letter still ends up with the previous letter. Like this:

    [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]Abyss
    AJ Styles (Green Attire)
    AJ Styles (Red Attire)
    Alex Shelley
    Animal
    Austin Aries
    Billy Gunn

    Bobby Lashley
    Boogeyman
    Brian Kendrick
    Brock Lesnar (WWE Attire)
    Brother Devon
    Brother Ray
    Chris Harris

    Chris Sabin (Old Attire)
    Christopher Daniels
    Christy Hemme
    Eddie Guerrero

    Goldberg (Black and White Attire)

    Gregory Helms
    Homicide

    James Mitchell

    James Storm
    Jeff Hardy (TNA Attire)
    Joey Mercury
    Kevin Nash (TNA Attire)

    Monty Brown (Black Attire)

    Monty Brown (Red Attire)
    Petey Williams

    Raven (Late 2005 Attire)

    Rhino
    Sabu

    Samoa Joe
    Shannon Moore
    Shark Boy (Classic Attire)
    Sonjay Dutt[/quote]

    Any suggestions? (Im new with PHP and MySQL ;) lol)
  4. My database and site are nearlly complete, but i need advice and help with two things.

    [b]1. Ordering the List[/b]
    Currently my list orders alphabetically like this: (example)

    [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]
    Al
    Andy
    Bean
    Bill
    Blake
    Can
    Christian
    [/quote]

    I somehow need to code it so the database puts a space between each beginning letter like this:

    [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]
    Al
    Andy

    Bean
    Bill
    Blake

    Can
    Christian
    [/quote]

    My Code 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";
    $result=mysql_query($query);

    $num=mysql_numrows($result);

    mysql_close();

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

    ?>

    <?
    $i=0;
    while ($i < $num) {
    $name=mysql_result($result,$i,"name");
    $category=mysql_result($result,$i,"category");
    ?>

    <?php echo "<a href='http://www.reef-break.com/cawcenter/svr2006/caw.php?name=$name'>$name</a><br>" ?>
    <?
    ++$i;
    }


    ?>

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


    [b]2. Seperating Data[/b]
    In my add data form, there is a category option. I need to make a series of pages that will list the appropriate data for each category ($category). For Example if the category was "A" then it would only list the names that were given that category in the add data form.

    Sorry if that sounds confusing, the code is the same as the one in my other problem.

    Ive been wondering how to do these for ages, and currently have no clue. So if someone could help me out here it would be [b]greatly[/b] appreciated :)
×
×
  • 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.