/    Sign up×
Community /Pin to ProfileBookmark

Working with 2 tables

Hi,

I have a reports page and on the reports I have a team line up:

[code=php]

<input name=”shirtone” type=”text” size=”35″ maxlength=”128″ value=”<?php echo $shirtone?>”>
<select name=”shirtone_quickpick” onChange=”window.document.reportform.shirtone.value = this.options[this.selectedIndex].value”;>
<option>Quick pick name…</option>
<option value=”Allaway”<? if ($shirtone == ‘Allaway’) echo ‘ selected’ ?>>Allaway
<option value=”Parkin”<? if ($shirtone == ‘Parkin’) echo ‘ selected’ ?>>Parkin
<option value=”Whincup”<? if ($shirtone == ‘Whincup’) echo ‘ selected’ ?>>Whincup
</select>

[/code]

When I hit submit the data I select from the dropdown either ‘Allaway’, ‘Parkin’ or
‘Whincup’ is then recorded in the $shirtone variable in that record in a ‘reports’ table.

So When I add 5 reports records with different id’s and for example have picked ‘Allaway’ five times I want that information that he has made 5 appearances to appear in a different table called ‘players’ in an input box with the value ‘5’

[code=php]

<input name=”allaway” type=”text” id=”allaway” value=”<?php echo $allaway?>” size=”36″>

[/code]

Then when I add another report again in the ‘report’ table and he is picked his appearances goes up to ‘6’ automatically in the ‘players’ table and appears in the above input box.

And so on…

How do I go about doing this – can anyone provide me with a code example.

Thanks

Chris

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@phpnoviceMar 04.2005 — Is there a defined relationship between the reports table and the players table? What is the key to the players table? ...and what indexes have you got on the players table? Is there a column for the player count or did you plan to use an SQL SUM to get the value? etc., etc., etc.

Too many unknowns for a question like this.
×

Success!

Help @chrisb spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...