Ok I have 3 pages that process code for editing a db. I have the page that lets you click the particular item in the db you want to edit, the edit page, and then the save page. I want to have a choice to edit by week then go to the edit page, and so forth, like if its week 2 then go to edit week2, so then it will just show week 2's edit info and not week one. Here is the table.
# phpMyAdmin MySQL-Dump
# version 2.3.3pl1
# [url]http://www.phpmyadmin.net/[/url] (download page)
#
# Host: localhost
# Generation Time: Dec 16, 2002 at 11:07 AM
# Server version: 3.23.52
# PHP Version: 4.2.3
# Database : `islanders`
# --------------------------------------------------------
#
# Table structure for table `prankings`
#
CREATE TABLE prankings (
id int(11) NOT NULL auto_increment,
team text NOT NULL,
teamabbr text NOT NULL,
1rank smallint(6) NOT NULL default '0',
1record varchar(12) NOT NULL default '',
1comment text NOT NULL,
2rank smallint(6) NOT NULL default '0',
2record varchar(12) NOT NULL default '',
2comment text NOT NULL,
3rank smallint(6) NOT NULL default '0',
3record varchar(12) NOT NULL default '',
3comment text NOT NULL,
curweek enum('1','2','3') NOT NULL default '1',
PRIMARY KEY (id)
) TYPE=MyISAM;
#
# Dumping data for table `prankings`
#
INSERT INTO prankings VALUES (1, 'Flyers', 'phi', 2, '1-1-0-0', 'Go Team Go.', 2, '1-1-0-0', 'Lost one.', 2, '2-1-0-0', 'Won there last game.', '1');
INSERT INTO prankings VALUES (2, 'Islanders', 'nyi', 1, '1-1-0-0', 'On a Role now.', 1, '2-0-0-0', 'test', 1, '2-1-0-0', 'test', '1');
INSERT INTO prankings VALUES (3, 'Stars', 'dal', 3, '1-1-0-0', 'testing', 0, '', '', 0, '', '', '1');
INSERT INTO prankings VALUES (4, 'Bruins', 'bos', 4, '0-0-0-0', 'None', 0, '', '', 0, '', '', '1');
INSERT INTO prankings VALUES (5, 'Red Wings', 'det', 5, '0-0-0-0', 'testing', 0, '', '', 0, '', '', '1');
INSERT INTO prankings VALUES (8, 'Blues', 'stl', 7, '0-0-0-0', 'Blues are ready to kick off the season.', 0, '', '', 0, '', '', '1');
INSERT INTO prankings VALUES (6, 'Canucks', 'van', 6, '0-0-0-0', 'go', 0, '', '', 0, '', '', '1');
INSERT INTO prankings VALUES (9, 'Devils', 'nj', 8, '0-0-0-0', 'test', 0, '', '', 0, '', '', '1');
INSERT INTO prankings VALUES (10, 'Wild', 'min', 9, '0-0-0-0', 'Minnesota', 0, '', '', 0, '', '', '1');
INSERT INTO prankings VALUES (11, 'Senators', 'ott', 11, '0-0-0-0', 'Senators', 0, '', '', 0, '', '', '1');
INSERT INTO prankings VALUES (12, 'Maple Leafs', 'tor', 10, '0-0-0-0', 'Leafs', 0, '', '', 0, '', '', '1');
INSERT INTO prankings VALUES (13, 'Oilers', 'edm', 12, '0-0-0-0', 'Leafs', 0, '', '', 0, '', '', '1');
INSERT INTO prankings VALUES (14, 'Penguins', 'pit', 13, '0-0-0-0', 'Leafs', 0, '', '', 0, '', '', '1');
INSERT INTO prankings VALUES (15, 'Lightning', 'tb', 14, '0-0-0-0', 'Leafs', 0, '', '', 0, '', '', '1');
INSERT INTO prankings VALUES (16, 'Blackhawks', 'chi', 15, '0-0-0-0', 'Blackhawks', 0, '', '', 0, '', '', '1');
INSERT INTO prankings VALUES (17, 'Kings', 'la', 16, '0-0-0-0', 'Blackhawks', 0, '', '', 0, '', '', '1');
INSERT INTO prankings VALUES (18, 'Hurricanes', 'car', 17, '0-0-0-0', 'Blackhawks', 0, '', '', 0, '', '', '1');
INSERT INTO prankings VALUES (19, 'Avalanche', 'col', 18, '0-0-0-0', 'Blackhawks', 0, '', '', 0, '', '', '1');
INSERT INTO prankings VALUES (20, 'Mighty Ducks', 'ana', 19, '0-0-0-0', 'Blackhawks', 0, '', '', 0, '', '', '1');
INSERT INTO prankings VALUES (21, 'Sharks', 'sj', 20, '0-0-0-0', 'Blackhawks', 0, '', '', 0, '', '', '1');
INSERT INTO prankings VALUES (22, 'Canadiens', 'mtl', 21, '0-0-0-0', 'Blackhawks', 0, '', '', 0, '', '', '1');
INSERT INTO prankings VALUES (23, 'Capitals', 'was', 22, '0-0-0-0', 'Blackhawks', 0, '', '', 0, '', '', '1');
INSERT INTO prankings VALUES (24, 'Rangers', 'nyr', 30, '0-0-0-0', 'Blackhawks', 0, '', '', 0, '', '', '1');
INSERT INTO prankings VALUES (25, 'Panthers', 'fla', 24, '0-0-0-0', 'Blackhawks', 0, '', '', 0, '', '', '1');
INSERT INTO prankings VALUES (26, 'Coyotes', 'pho', 25, '0-0-0-0', 'Blackhawks', 0, '', '', 0, '', '', '1');
INSERT INTO prankings VALUES (27, 'Blue Jackets', 'cmb', 26, '0-0-0-0', 'Blackhawks', 0, '', '', 0, '', '', '1');
INSERT INTO prankings VALUES (28, 'Sabres', 'buf', 27, '0-0-0-0', 'Blackhawks', 0, '', '', 0, '', '', '1');
INSERT INTO prankings VALUES (29, 'Predators', 'nas', 28, '0-0-0-0', 'Blackhawks', 0, '', '', 0, '', '', '1');
INSERT INTO prankings VALUES (30, 'Flames', 'cal', 29, '0-0-0-0', 'Blackhawks', 0, '', '', 0, '', '', '1');
INSERT INTO prankings VALUES (31, 'Thrashers', 'atl', 23, '0-0-0-0', 'Bumped up.', 0, '', '', 0, '', '', '1');
Now for the edit page.
<table border=1 cellpadding=1 cellspacing=1>
<tr>
<td colspan=4>Click on the team to edit its information.
</td></tr>
<?php
include "config.php";
$db = mysql_connect($database,$username,$password);
mysql_select_db ($database) or die ("Cannot connect to database");
/* We have now connected, unless you got an error message */
/* Lets display the current titles, so we can select one for editing */
echo "<tr><td><b>Team</b></td><td><b>Current Rank</b></td><td><b>Record Week 1</b></td><td><b>Comment</b></td></tr>";
$query = "SELECT id, team, 1rank, 1record, 1comment FROM prankings ORDER BY 1rank";
$result = mysql_query($query);
/* Here we fetch the result as an array */
while($r=mysql_fetch_array($result))
{
/* This bit sets our data from each row as variables, to make it easier to display */
$id=$r["id"];
$team=$r["team"];
$rank1=$r["1rank"];
$record1=$r["1record"];
$comment1=$r["1comment"];
/* Now lets display the titles */
echo "<tr>
<td><A HREF=\"edit_process.php?id=$id\">$team</A><BR>
</td>
<td align=center>$rank1
</td>
<td>$record1
</td>
<td>$comment1
</td>
</tr>";
}
mysql_close($db);
?>
</table>
Edit process page
<table border=1 cellpadding=0 cellspacing=0>
<tr>
<td>
<?php
include "config.php";
$db = mysql_connect($database,$username,$password);
mysql_select_db ($database) or die ("Cannot connect to database");
/* We have now connected, unless you got an error message */
/* We now select one news post, and bring it into some text boxes */
$query = "SELECT * FROM prankings WHERE id = $_GET[id]";
$result = mysql_query($query);
while($r=mysql_fetch_array($result))
{
/* This bit sets our data from each row as variables, to make it easier to display */
$team=$r["team"];
$teamabbr=$r["teamabbr"];
$rank1=$r["1rank"];
$record1=$r["1record"];
$comment1=$r["1comment"];
/* Now lets display the titles */
echo "<img src=../images/powerrankings/$teamabbr.gif border=0 width=50 height=50></td>
<td>$team</td>
<tr>
<form name=\"edit_process.php\" method=\"post\" action=\"edit_save.php?id=$_GET[id]\">
<td>Rank</td>
<td><select name='1rank' size='1'>
<option selected value=$rank1>$rank1</option>
<option value='1'>1</option>
<option value='2'>2</option>
<option value='3'>3</option>
<option value='4'>4</option>
<option value='5'>5</option>
<option value='6'>6</option>
<option value='7'>7</option>
<option value='8'>8</option>
<option value='9'>9</option>
<option value='10'>10</option>
<option value='11'>11</option>
<option value='12'>12</option>
<option value='13'>13</option>
<option value='14'>14</option>
<option value='15'>15</option>
<option value='16'>16</option>
<option value='17'>17</option>
<option value='18'>18</option>
<option value='19'>19</option>
<option value='20'>20</option>
<option value='21'>21</option>
<option value='22'>22</option>
<option value='23'>23</option>
<option value='24'>24</option>
<option value='25'>25</option>
<option value='26'>26</option>
<option value='27'>27</option>
<option value='28'>28</option>
<option value='29'>29</option>
<option value='30'>30</option>
</select>
</td>
</tr>
<tr>
<td>Record
</td>
<td><input type='text' name='1record' value='$record1'>
</td>
</tr>
<tr>
<td>Comment :</td>
<td><textarea name=\"1comment\" cols=\"40\" rows=\"6\">$comment1</textarea></td>
</tr>
<tr>
<td colspan=2><input type=\"submit\" name=\"Submit\" value=\"Save\">
</form>";
}
mysql_close($db);
?>
</td></tr>
</table>
Edit Save page
<?php
include "config.php";
$db = mysql_connect($database,$username,$password);
mysql_select_db ($database) or die ("Cannot connect to database");
/* We have now connected, unless you got an error message */
/* Lets save some news ! */
$query = "UPDATE prankings SET 1rank='".$_POST['1rank']."', 1record='".$_POST['1record']."', 1comment='".$_POST['1comment']."' WHERE id = '".$_GET['id']."'";
mysql_query($query);
echo "Team item saved.<br>
<a href=edit.php>Return to Edit page</a><br>
<a href=../powerrankings/index.php>Go to Power Rankings Page</a>";
mysql_close($db);
?>
Config page
<?php
$username = "username";
$password = "password";
$host = "localhost";
$database = "islanders";
?>
HELP!