select - sql - selecting, counting and Updating -


i'm wondering if correct...

i want select users teams in match , add win, loose or draw profile.

$short = $_post['short']; $opponent = $_post['opponent']; $oppuser = safe_query("select userid ".prefix."teams_members teamid='".$opponent."'"); $shortuser = safe_query("select userid ".prefix."teams_members teamid='".$short."'");  safe_query("update ".prefix."teams_members set win=win+1 userid='".$oppuser."'"); safe_query("update ".prefix."teams_members set lost=lost+1 userid='".$shortuser."'"); 

something not allowing updating rows.

you don't need selects. update not working because select statement returning multiple entries. can update entire team without selecting users:

$short    = $_post['short']; $opponent = $_post['opponent'];  safe_query("update ".prefix."teams_members set win=win+1 teamid='$opponent'"); safe_query("update ".prefix."teams_members set lost=lost+1 teamid='$short'"); 

Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -