Delete one column from table, Update another with PHP MYSQL -
i have 2 tables. 1 table matches table (e2wedstrijden) , table scoring table points earned etc. (e2teams).
now have can delete match e2wedstrijden table. , working fine.
but want if delete match table. add or decrease points table ("e2teams"). tried compare tables not working.
so want example:
if($row['thuisscore'] == $row['uitscore']) row names in e2wedstrijden table. if these 2 same (like 0-0 or 1-1 or something) needs decrease 1 point table e2teams. teams same rows "thuisteam" , "uitteam" in e2wedstrijden table. row thuisteam (in "e2wedstrijden") needs find same result in ("e2teams") row team. , needs done same row uitteam (in "e2wedstrijden") needs find same result in ("e2teams")
thuisteam , uitteam = dutch hometeam , awayteam. think fault system can't link 'thuisteam' e2wedstrijden team in e2teams don't know how solve it
this deletematches.php, deletes match doesn't decrease or adds points:
<?php if(!isset($_cookie['e2ingelogd'])) { header("location:../../index.php"); } include "../../connect.php"; $dbhandle = mysql_connect($hostname, $username, $password) or die("could not connect database"); $selected = mysql_select_db("login", $dbhandle); $result = mysql_query("select * e2wedstrijden id = ".$_get['del'].""); while($row = mysql_fetch_assoc($result)){ if( $row['thuisscore'] == $row['uitscore']){ echo $row['thuisscore']; mysql_query("update e2teams set punten = punten-1 team ='".$row['thuisteam']."'"); mysql_query("update e2teams set gespeeld = gespeeld-1 team = ('".$row['thuisteam']."'"); mysql_query("update e2teams set verloren = gelijk-1 team ='".$row['uitteam']."'"); echo "team deleted"; }else{ echo 'update error!'; } } $table_1_delete = mysql_query("delete e2wedstrijden id = ".$_get['del'].""); ?> this e2teams table:
and e2wedstrijden table: 
so need like:
update e2teams set punten = punten-1 team = in table ("e2wedstrijden) deleted thuisteam , deleted uitteam hope can help
you've placed parentheses in 2nd query "gespeeld" right after equal sign:
mysql_query("update e2teams set gespeeld = gespeeld-1 team = ('".$row['thuisteam']."'"); is isn't updating?
Comments
Post a Comment