Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Results 1 to 6 of 6
  1. #1
    Join Date
    Feb 2008
    Location
    Scotland
    Posts
    151
    Tokens
    500

    Latest Awards:

    Default Help adding to my excisting database.

    Hi all. I have a submit forum with the following fields you see below. I have the following fields home team, away team, home score and away score..but I want to add more fields of course I know how to do this...but the problem is when they submit the results it stores to my database I have all set up, but I want it so it then display on my website like the home away sections already do. Below I have also posted the other part of my code this is the section of code I'm having problems with I don't know what php code to put to display anyway other fields I wish to make for example Goal scores. Any help will be much appreciated.

    PHP Code:
    <?php
                        
    if($user->data['is_registered'])
                            {
                            
    ?>
                                <p class="main_text">
                                    Please use this form to submit results. If you have any issues, please let us know on the forums.
                                    <br /><br />
                                </p>
                                <div align="center" id="form">
                                 <form action="insert.php" method="post">
                                   <input name="HomeTeam" type="text" value="home team name" class="input" maxlength="25" />
                                   <input name="AwayTeam" type="text" value="away team name" class="input" maxlength="25" />
                                   <input name="HomeScore" type="text" value="0" class="input" maxlength="2" />
                                   <input name="AwayScore" type="text" value="0" class="input" maxlength="2" />
    <input name="League" type="text" value="League Name" class="input" maxlength="30" />
                                   <input name="Submitter" type="hidden" value="<?php echo($user->data['username']);?>" />
                                   <input name="Date" type="hidden" value="<?php $date date("Y-m-d"); echo($date);?>" />
                                   <div align="center"><input name="submit" type="submit" value="Submit Result" class="submit" /></div>
                                 </form>
                                </div>
                             <?php
    PHP Code:
    <?php
                    $con 
    mysql_connect("localhost","******","*****");
                    if (!
    $con)
                      {
                      die(
    'Could not connect, please notify an admin: ' mysql_error());
                      }
                    
                    
    mysql_select_db("*******"$con);
                
                
    $query  "SELECT hometeam, awayteam, homescore, awayscore, league, date FROM results ORDER BY id DESC";
                
    $result mysql_query($query);
                
                
    ?>
                    <div align="center"><table class="results_table">
                    <tr>
                      <td width="25%" class="results_header">Home Team:</td>
                      <td width="25%" class="results_header">Away Team:</td>
                      <td width="15%" class="results_header">Home Score:</td>
                      <td width="15%" class="results_header">Away Score:</td>
                      <td width="20%" class="results_header">Date:</td>
                      </tr>
                <?php
                
    while($row mysql_fetch_array($resultMYSQL_ASSOC))
                {
                    
    ?>
                        <tr>
                            <td class="results_data"><?php echo($row['hometeam']);?></td>
                            <td class="results_data"><?php echo($row['awayteam']);?></td>
                            <td class="results_data"><strong><?php if($row['homescore'] > $row['awayscore'])
                            {echo(
    '<font color="green">');} else if($row['homescore'] < $row['awayscore']) { echo('<font color="red">');}
                            echo(
    $row['homescore']);?>
                            </font></strong>
                            </td>
                            <td class="results_data"><strong><?php if($row['awayscore'] > $row['homescore'])
                            { echo(
    '<font color="green">');} else if($row['awayscore'] < $row['homescore']) { echo('<font color="red">');}
                            echo(
    $row['awayscore']);?>
                            </font></strong>
                            </td>
                            <td class="results_data"><?php echo($row['date']);?></td>
                        </tr>
                        
                <?php
                
    }
                
    ?>

  2. #2
    Join Date
    Sep 2005
    Location
    East London
    Posts
    3,028
    Tokens
    0

    Latest Awards:

    Default

    Spell existing properly and i will help you

  3. #3
    Join Date
    Feb 2008
    Location
    Scotland
    Posts
    151
    Tokens
    500

    Latest Awards:

    Default

    Still looking for some help please. Also once I have this done, I hope to maybe hire someone to add to my script payment will be offered of course.

    @Jackboy - Was a mistake -.- also you know I can't edit my post.

  4. #4
    Join Date
    Jul 2004
    Location
    Ottawa, Canada
    Posts
    1,363
    Tokens
    106
    Habbo
    Yonder

    Latest Awards:

    Default

    Cant understand the post.

    Do you wish to insert new row(s) into the database
    OR
    The rows already exist but you do not know how to call them?

    Because your post suggests you know how to add fields etc but your post also suggests you do not know how to display them via php, when you clearing have done with the Home/Away/Scores etc.

  5. #5
    Join Date
    Feb 2008
    Location
    Scotland
    Posts
    151
    Tokens
    500

    Latest Awards:

    Default

    Quote Originally Posted by Yonder454 View Post
    Cant understand the post.

    Do you wish to insert new row(s) into the database
    OR
    The rows already exist but you do not know how to call them?

    Because your post suggests you know how to add fields etc but your post also suggests you do not know how to display them via php, when you clearing have done with the Home/Away/Scores etc.
    I know how to add fields yes. I have the new rows in my database. All it is I'm having problems displaying then on my site the same way the others already do.
    Last edited by WeeGiE; 05-11-2008 at 01:07 PM.

  6. #6
    Join Date
    Jul 2004
    Location
    Ottawa, Canada
    Posts
    1,363
    Tokens
    106
    Habbo
    Yonder

    Latest Awards:

    Default

    $query = "SELECT goals, hometeam, awayteam, homescore, awayscore, league, date FROM results ORDER BY id DESC";

    Make sure you include the row you are calling e.g. goals

    <?php echo($row['goals']);?>

    Then insert something like that.

    Understand, main thing is remembering to call it in the query.
    Last edited by Yonder; 05-11-2008 at 02:59 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •