Jump to content

Allow members ability to display and edit specific info in MySQL table


kemper

Recommended Posts

I am hosting a sports website and am processing schedules for the particpating clubs to assign times and field assignments.  An example table is as follows:

[table]
[tr]
[td][b]Club[/b][/td]
[td][b]Age[/b][/td]
[td][b]Date[/b][/td]
[td][b]Time/Notes[/b][/td]
[td][b]Time[/b][/td]
[td][b]Home[/b][/td]
[td][b]Visitors[/b][/td]
[td][b]Field[/b][/td]
[/tr]
[tr]
[td]Club 1[/td]
[td][center]7[/center][/td]
[td]04/21/07[/td]
[td] [/td]
[td] [/td]
[td]Team 1[/td]
[td]Team 2[/td]
[td] [/td]
[/tr]
[tr]
[td]Club 2[/td]
[td][center]9[/center][/td]
[td]04/21/07[/td]
[td]after 1pm[/td]
[td] [/td]
[td]Team 3[/td]
[td]Team 2[/td]
[td] [/td]
[/tr]
[tr]
[td]Club 2[/td]
[td][center]8[/center][/td]
[td]04/28/07[/td]
[td] [/td]
[td] [/td]
[td]Team 2[/td]
[td]Team 1[/td]
[td] [/td]
[/tr]
[tr]
[td]Club 1[/td]
[td][center]7[/center][/td]
[td]05/05/07[/td]
[td] [/td]
[td] [/td]
[td]Team 1[/td]
[td]Team 3[/td]
[td] [/td]
[/tr]
[tr]
[td]Club 3[/td]
[td][center]8[/center][/td]
[td]05/05/07[/td]
[td]before 3pm[/td]
[td] [/td]
[td]Team 3 [/td]
[td]Team 1[/td]
[td] [/td]
[/tr]
[tr]
[td]Club 3[/td]
[td][center]9[/center][/td]
[td]05/05/07[/td]
[td] [/td]
[td] [/td]
[td]Team 3[/td]
[td]Team 5[/td]
[td] [/td]
[/tr]
[/table]

[color=blue][i]What I want to do allow schedules from each club to see and edit their own specific schedules (eq. Club 1 would display only their own rows and be able to input times into "Time" column and specific field assignments into "Field" column).[/i][/color]

I am not exactly sure where to start.  I have the complete schedule with 30 different clubs and 12 different ages in a MySQL database table already.

Assistance is greatly appreciated.
that is a fairly easy project but it has a few steps that need to be implemented first so its a little hard to help you without knowing what you already have accomplished.

First, you need a member database that lets people log in; Do you have that?  If not, thats where you need to start.

Each Club Scheduler has already been assigned to the specific club, so I do not need the precursor "Club" select and submit.

Let's say I log in and only want to see and edit only "Club 2". How can I write the script to display and allow editting to only "Club 2"?
I was told to use a script like:

[code]<?php

include("config.inc.php");

if ($db == 1) {
echo "<center><font face='Arial' size='4' color='#000000'><b>Results:</b></font></center><br><br>\n\n";
}

if($db==1) {
// mySQL Table
$db_con = mysql_connect(MyHost, MyUsername, MyPassword) or die("Connetion to database failed!");
mysql_select_db(MyDatabase);
$query="SELECT * FROM test where MyTable =". $_POST['Club 1']."";
$result=mysql_query($query);
while ($row = mysql_fetch_assoc($res)) {
## format it by table, paragraph or div, whatever format
$row['field_scheduler']
$row['division']
$row['time']
$row['date']
$row['time_notes']
$row['time']
$row['home_team']
$row['visitor_team']
$row['home_field']
echo '<a href="editpage.php?id='.$row[id].'">EDIT</a>';
echo '<a href="deletepage.php?id='.$row[id].'">DELETE</a>'
}

?>[/code]

This gave me error:
Parse error: syntax error, unexpected T_VARIABLE in /home/kemper/public_html/mysite/schedules.php on line 18

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.