spinFIRE Posted March 23, 2006 Share Posted March 23, 2006 Hello...I have made a litte (for fun) betting site, where users can bet on football matchesThey 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 Link to comment https://forums.phpfreaks.com/topic/5611-mysql-help-needed/ Share on other sites More sharing options...
keeB Posted March 23, 2006 Share Posted March 23, 2006 [!--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 matchesThey 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--] Quote Link to comment https://forums.phpfreaks.com/topic/5611-mysql-help-needed/#findComment-20040 Share on other sites More sharing options...
spinFIRE Posted March 23, 2006 Author Share Posted March 23, 2006 Sorry, but I've think you've misunderstood the purpose.Example:Before betting:[code]Benfica vs. BarcelonaArsenal vs. JuventusInternazionale vs. VillarrealLyon vs. Milan[/code]After betting on Benfica vs. Barcelona:[code]Arsenal vs. JuventusInternazionale vs. VillarrealLyon 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] Quote Link to comment https://forums.phpfreaks.com/topic/5611-mysql-help-needed/#findComment-20046 Share on other sites More sharing options...
redbullmarky Posted March 23, 2006 Share Posted March 23, 2006 can you post your MySQL table structures? Quote Link to comment https://forums.phpfreaks.com/topic/5611-mysql-help-needed/#findComment-20067 Share on other sites More sharing options...
spinFIRE Posted March 23, 2006 Author Share Posted March 23, 2006 [!--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 IDip varchar(15) <- Users ipnavn varchar(30) <- Users nameklasse varchar(8) <- Class the user is inresultath varchar(2) <- The home team goalsresultatu varchar(2) <- The away team goalstegn char(1) < Like 1, X or 2[/code]table: kampe <-matches[code]Field Typeid varchar(2) <- id dd varchar(2) <- match playing ddmm varchar(2)<- match playing mm hjemmehold varchar(25)<- home teamudehold varchar(25) <- away teamresultat varchar(5) <- result of the game (not implented yet)[/code] Quote Link to comment https://forums.phpfreaks.com/topic/5611-mysql-help-needed/#findComment-20083 Share on other sites More sharing options...
wickning1 Posted March 23, 2006 Share Posted March 23, 2006 You really should have at least 3 tables - one for matches, one for users, and one for recording users' betsSo something like this:[code]table: matchesmatchiddateplaying <-- no need to store month and day separatelyhometeamawayteamresultstable: usersuseridusernameuseripuserclasstable: betsuserid <-- points to a row in the users tablematchid <-- points to a row in the matches tablehomegoalsawaygoalstegn <-- Don't understand what that is; may be in the wrong place[/code] Quote Link to comment https://forums.phpfreaks.com/topic/5611-mysql-help-needed/#findComment-20100 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.