home hardware prices news articles forums photos user reviews
Go Back   Tech Support Forums - TechIMO.com > PC Hardware and Tech > Webmastering and Programming
Join TechIMO for Free!
Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read
Reply Get bargains at  »  Dealighted.com
 
Thread Tools
Currently Active Users: 1747
Discussions: 188,402, Posts: 2,243,608, Members: 232,631
Old August 16th, 2004, 08:47 PM   Digg it!   #1 (permalink)
Perfetc Member
 
VHockey86's Avatar
 
Join Date: Jan 2003
Location: Maryland Suburbia
Posts: 4,327
php data entry question

Well, I have yet to get around to learning java/php so I was wondering if anyone here could lead me in the right direction.

Basically heres the general premesis of what I'm trying to accomplish.
I designed a website for a friend's halo clan that competes in matches with other clans and stuff. I was thinking it would be cool to add some sort of "recent matches" display on the site, however I dont really want to have to update it myself manually all the time.
So I came up with another idea but am not really sure how to code/impliment it.
Perhaps what I am thinking of isnt possible, but it didnt seem too hard in theory.

Create a form that the other members can goto on the page. The form would be a basic html form and contain boxes for like a date, a game type, the opposing clan, score, win/lose. There sorta thing.

I would like to make it so that this imformation was processed by perhaps a php file, and stored in a file/database.

Then on the main page, a box would read the submitted information and show it in a corresponding table.

In short, a form to submit information into an information box on the web page.

If this doesnt really make any sense let me know. If its really simple and someone wouldnt mind coding it I'd really appreciate it, otherwise perhaps some instructions on what I'd actualy need to do would be helpful (like what functions or something).

Not that it particularily matters, but heres a link to the site:
http://s90390266.onlinehome.us/newclan/
I have access to a mysql database too if that helps any.

Thx,
Vhockey86

VHockey86 is offline   Reply With Quote
Old August 17th, 2004, 02:03 AM     #2 (permalink)
Perfetc Member
 
VHockey86's Avatar
 
Join Date: Jan 2003
Location: Maryland Suburbia
Posts: 4,327
Well after finding this guide,
http://dev.mysql.com/tech-resources/...s/ddws/20.html
and about 2 hours of reading/interpreting/editing code I managed to sort of get something working

Submission form:
http://s90390266.onlinehome.us/newclan/test.htm
Results form mysql database:
http://s90390266.onlinehome.us/newclan/viewmatches.php

Now my problem is..... new entries are added AFTER the other one (makes sense of course), but since its a "recent" matches list, I want the most recent entry to be display BEFORE the other.
Anyone know what I need to do to change this?
Heres how I have my submission file coded:
Code:
 <?php // Connect to the database server
    $dbcnx = @mysql_connect("removed", "removed", "removed");
    if (!$dbcnx) {
      echo( "<P>Unable to connect to the " .
            "database server at this time.</P>" );
      exit();
    }

    // Select the database
    if (! @mysql_select_db("db106426321") ) {
      echo( "<P>Unable to locate the joke " .
            "database at this time.</P>" );
      exit();
    }

    // add it to the database.
      $sql = "INSERT INTO matches SET " .
             "opponet='$opponet', " .
			 "members='$members', " .
			 "level='$level', " .
			 "gametype='$gametype', " .
			 "outcome='$outcome', " .
             "date=CURDATE()";
      if (mysql_query($sql)) {
        echo("<P>Your entry has been added.</P>");
      } else {
        echo("<P>Error adding submitted entry: " .
             mysql_error() . "</P>");
      }
 ?>
And heres the file that views from the database

Code:
<body>
<?php $dbcnx = @mysql_connect("removed", "removed", "removed");
if (!$dbcnx) {
  echo( "<P>Unable to connect to the " .
        "database server at this time.</P>" );
  exit();
}
if (! @mysql_select_db("db106426321") ) {
  echo( "<P>Unable to locate the joke " .
        "database at this time.</P>" );
  exit();
}
  
 
?>
<table border="1" bordercolor="#00CCFF" cellpadding="3" cellspacing="3">
  <tr>
    <td>Date</td>
    <td>Opponet (Clan) </td>
    <td>TU Members </td>
    <td>Level</td>
    <td>Game Type </td>
    <td>Outcome (win/lose) </td>
  </tr>
  <tr><td>
<?php
 // Request the text of all Dates
  $result = mysql_query(
            "SELECT date FROM matches");
  if (!$result) {
    echo("<P>Error performing query: " .
         mysql_error() . "</P>");
    exit();
  }
  while ( $row = mysql_fetch_array($result) ) {
    echo($row["date"] . "<br>");
  }
?>
</td><td>
<?php
$result = mysql_query(
            "SELECT opponet FROM matches");
  if (!$result) {
    echo("<P>Error performing query: " .
         mysql_error() . "</P>");
    exit();
  }
  while ( $row = mysql_fetch_array($result) ) {
    echo($row["opponet"] . "<br>");
  }
?>
</td><td>
<?php
$result = mysql_query(
            "SELECT members FROM matches");
  if (!$result) {
    echo("<P>Error performing query: " .
         mysql_error() . "</P>");
    exit();
  }
  while ( $row = mysql_fetch_array($result) ) {
    echo($row["members"] . "<br>");
  }
?>
</td><td>
<?php
$result = mysql_query(
            "SELECT level FROM matches");
  if (!$result) {
    echo("<P>Error performing query: " .
         mysql_error() . "</P>");
    exit();
  }
  while ( $row = mysql_fetch_array($result) ) {
    echo($row["level"] . "<br>");
  }
?>
</td><td>
<?php
$result = mysql_query(
            "SELECT gametype FROM matches");
  if (!$result) {
    echo("<P>Error performing query: " .
         mysql_error() . "</P>");
    exit();
  }
  while ( $row = mysql_fetch_array($result) ) {
    echo($row["gametype"] . "<br>");
  }
?>
</td><td>
<?php
$result = mysql_query(
            "SELECT outcome FROM matches");
  if (!$result) {
    echo("<P>Error performing query: " .
         mysql_error() . "</P>");
    exit();
  }
  while ( $row = mysql_fetch_array($result) ) {
    echo($row["outcome"] . "<br>");
  }
?>
</td></tr></table>

</body>
Any help appreciated, sorry for the really long post


Last edited by VHockey86 : August 17th, 2004 at 02:08 AM.
VHockey86 is offline   Reply With Quote
Old September 8th, 2004, 03:01 PM     #3 (permalink)
Junior Member
 
Join Date: Sep 2004
Posts: 1
If it were me, I would just run one loop and pull all the info from the table ordered by date. Then you can step through and output a table of the ordered matches.

-Dana

RNA411 is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may post new threads
You may post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Wrist Pain ---- Carpal Tunnel? ? your advice? yomama IMO Community 29 August 28th, 2004 05:42 PM
php help Andybebad Webmastering and Programming 6 April 16th, 2004 06:40 AM
Pointers as parameters...HELP! squeech Webmastering and Programming 1 September 16th, 2003 11:45 PM
do i need HTML to work in PHP web designing? meanguy21 Graphic Design and Digital Photography 16 March 28th, 2003 09:39 AM

Most Active Discussions
Is It Just Me? (2906)
Unarmed man on his stomach shot by .. (6)
Misery Loves Company... (2144)
New Build ( Finally ) (7)
CPU wont boot (7)
Building a gaming computer advice (5)
I think I just killed my computer w.. (24)
RCA 52Inch HDTV wont turn on (5)
Folderchat Weekday thread (444)
Recent Discussions
Please help! multiple problems! (4)
How to transfer music from iPod.. (0)
RCA 52Inch HDTV wont turn on (5)
New Build ( Finally ) (7)
Common Spyware Solutions (97)
How do you move a hard-drive to.. (4)
Laptop proccesor to desktop mob.. (1)
What is the best external enclo.. (0)
Partition Magic 7.0 (Unallocate.. (17)
Blackberry Storm, Gears of War .. (1)
Core 2 Quad Q9550 system (3)
COWBOOM Ripoff! Used Laptop w/$.. (4)


All times are GMT -4. The time now is 04:01 AM.
TechIMO Copyright 2008 All Enthusiast, Inc.



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28