Jump to content


Photo

MySQL help needed


  • Please log in to reply
5 replies to this topic

#1 spinFIRE

spinFIRE
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 23 March 2006 - 05:14 PM

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

#2 keeB

keeB
  • Staff Alumni
  • Advanced Member
  • 1,078 posts
  • LocationCalifornia

Posted 23 March 2006 - 05:59 PM

[!--quoteo(post=357673:date=Mar 23 2006, 05:14 PM:name=spinFIRE)--][div class=\'quotetop\']QUOTE(spinFIRE @ Mar 23 2006, 05:14 PM) View Post[/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] FROM tblName WHERE ip = '[span style=\'color:orange\']<users ip>'[/span] [!--sql2--][/div][!--sql3--]

Come visit my site to see my latest projects
http://nick.stinemates.org/wordpress/


#3 spinFIRE

spinFIRE
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 23 March 2006 - 06:10 PM

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

Before betting:
Benfica vs. Barcelona
Arsenal vs. Juventus
Internazionale vs. Villarreal
Lyon vs. Milan

After betting on Benfica vs. Barcelona:
Arsenal vs. Juventus
Internazionale vs. Villarreal
Lyon vs. Milan

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

I have following tables in the database:

*kampe < danish for matches
*sessions < not used, yet
*tips < danish for betting

[a href=\"http://spinfire.pastebin.com/618349\" target=\"_blank\"]Index.htm[/a]
[a href=\"http://spinfire.pastebin.com/618356\" target=\"_blank\"]tips.php[/a]


#4 redbullmarky

redbullmarky
  • Staff Alumni
  • Advanced Member
  • 2,863 posts
  • LocationBedfordshire, England

Posted 23 March 2006 - 06:32 PM

can you post your MySQL table structures?
"you have to keep pissing in the wind to learn how to keep your shoes dry..."

I say old chap, that is rather amusing!

#5 spinFIRE

spinFIRE
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 23 March 2006 - 07:10 PM

[!--quoteo(post=357717:date=Mar 23 2006, 07:32 PM:name=redbullmarky)--][div class=\'quotetop\']QUOTE(redbullmarky @ Mar 23 2006, 07:32 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
can you post your MySQL table structures?
[/quote]
table: tips <-betting
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

table: kampe <-matches
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)


#6 wickning1

wickning1
  • Members
  • PipPipPip
  • Advanced Member
  • 405 posts

Posted 23 March 2006 - 07:56 PM

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

So something like this:

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





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users