Jump to content

MySQL help needed


spinFIRE

Recommended Posts

Hello...
I have made a litte (for fun) betting site, where users can bet on football matches
They login with their names and it shows the matches that they can bet on.
When they bet on one match their name, class and ip gets stored into a database...
But then when they shall bet again on the next match how can i then remove the matches they already have betted on?

-spinFIRE
Link to comment
Share on other sites

[!--quoteo(post=357673:date=Mar 23 2006, 05:14 PM:name=spinFIRE)--][div class=\'quotetop\']QUOTE(spinFIRE @ Mar 23 2006, 05:14 PM) [snapback]357673[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Hello...
I have made a litte (for fun) betting site, where users can bet on football matches
They login with their names and it shows the matches that they can bet on.
When they bet on one match their name, class and ip gets stored into a database...
But then when they shall bet again on the next match how can i then remove the matches they already have betted on?

-spinFIRE
[/quote]

I wouldn't suggest removing them from the database unless you absolutely need to.. Imagine at the end of football season, you can see what bets were placed, who won the most, etc, and give people some bragging rights. Statistics are good for a great number of things :)

If you absolutely need to remove them from the database, the query would look like..
[!--sql--][div class=\'sqltop\']SQL[/div][div class=\'sqlmain\'][!--sql1--][span style=\'color:blue;font-weight:bold\']DELETE[/span] [color=green]FROM[/color] [color=orange]tblName[/color] [color=green]WHERE[/color] ip [color=orange]=[/color] [color=red]'[span style=\'color:orange\']<[/color]users ip[color=orange]>[/color]'[/span] [!--sql2--][/div][!--sql3--]
Link to comment
Share on other sites

Sorry, but I've think you've misunderstood the purpose.
Example:

Before betting:
[code]
Benfica vs. Barcelona
Arsenal vs. Juventus
Internazionale vs. Villarreal
Lyon vs. Milan
[/code]

After betting on Benfica vs. Barcelona:
[code]
Arsenal vs. Juventus
Internazionale vs. Villarreal
Lyon vs. Milan
[/code]

But the info would still be in the database...

I have following tables in the database:

[code]
*kampe < danish for matches
*sessions < not used, yet
*tips < danish for betting
[/code]

[a href=\"http://spinfire.pastebin.com/618349\" target=\"_blank\"]Index.htm[/a]
[a href=\"http://spinfire.pastebin.com/618356\" target=\"_blank\"]tips.php[/a]
Link to comment
Share on other sites

[!--quoteo(post=357717:date=Mar 23 2006, 07:32 PM:name=redbullmarky)--][div class=\'quotetop\']QUOTE(redbullmarky @ Mar 23 2006, 07:32 PM) [snapback]357717[/snapback][/div][div class=\'quotemain\'][!--quotec--]
can you post your MySQL table structures?
[/quote]
table: tips <-betting
[code]Field     Type     
id      varchar(2) <- Match ID
ip      varchar(15) <- Users ip
navn      varchar(30) <- Users name
klasse      varchar(8) <- Class the user is in
resultath      varchar(2) <- The home team goals
resultatu      varchar(2) <- The away team goals
tegn      char(1) < Like 1, X or 2
[/code]

table: kampe <-matches
[code]
Field      Type
id  varchar(2) <- id    
dd  varchar(2) <- match playing dd
mm varchar(2)<- match playing mm
hjemmehold varchar(25)<- home team
udehold varchar(25) <- away team
resultat  varchar(5) <- result of the game (not implented yet)
[/code]
Link to comment
Share on other sites

You really should have at least 3 tables - one for matches, one for users, and one for recording users' bets

So something like this:

[code]table: matches
matchid
dateplaying  <-- no need to store month and day separately
hometeam
awayteam
results

table: users
userid
username
userip
userclass

table: bets
userid <-- points to a row in the users table
matchid <-- points to a row in the matches table
homegoals
awaygoals
tegn <-- Don't understand what that is; may be in the wrong place[/code]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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