SHARE
TWEET

Untitled

a guest Feb 22nd, 2019 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $sqlScore = "UPDATE game SET currentTurn = '1', remainingTiles='".$remainingTiles."' WHERE gameID = '".$gameID."'";
  2. mysql_query( $sqlScore ) or die ( mysql_error() );
  3.  
  4. $ScoreSelect = set_mysql( "SELECT * FROM game WHERE gameID = '".$gameID."'" );
  5. $up_gameID = $ScoreSelect['gameID'];
  6. $set_p1 = $ScoreSelect['player1'];
  7.  
  8. // CHECK IF GAMEID EXIST FOR SCORE
  9. $checkData = mysql_query( "SELECT * FROM score WHERE gameID = '".$gameID."' " ) or die ( mysql_error() );
  10. $rcd = mysql_fetch_array( $checkData );
  11. $rcd['gameID'] == $gameID
  12. ? mysql_query( "UPDATE score SET score = '".$score."' WHERE gameID = '".$gameID."' " ) or die ( mysql_error() )
  13. : mysql_query( "INSERT INTO score VALUE( '', '".$gameID."', '".$player1."', '".$score."')" ) or die ( mysql_error() );
  14.  
  15. // INSERT SQL WORD DATA
  16. $sqlWD = mysql_query( "INSERT INTO word_data VALUE( '', '".$gameID."', '', '".$worddata."')" ) or die ( mysql_error() );
  17.  
  18. // CHECK FOR TILE
  19. $sqlCheckRow = mysql_query( "SELECT * FROM wctilerack WHERE gameID = '".$up_gameID."' AND email = '".$up_email_player1."' " ) or die ( mysql_error() );
  20. if ( mysql_num_rows( $sqlCheckRow ) == "1" ) {
  21.     // INSERT wctilerack
  22.     $sqlTileUP = mysql_query( "UPDATE wctilerack SET tiles = '$playerRack' WHERE gameID = '".$up_gameID."' AND email = '".$up_email_player1."' ") or die ( mysql_error() );
  23. } else {
  24.     // INSERT wctilerack
  25.     $sqlTileINSERT = mysql_query( "INSERT INTO wctilerack VALUE('', '".$up_gameID."', '".$up_email_player1."', '$playerRack' ) ") or die ( mysql_error() );
  26. }
  27.  
  28. // UPDATE lastPlayed
  29. $sqlUpdatePlayed = mysql_query( "UPDATE user SET lastPlayed=NOW() WHERE email = '$up_email_player1' " ) or die ( mysql_error() );
  30. // UPDATE word
  31. $sqlUpdateWord = mysql_query( "UPDATE game SET lastWord = '".$xword[2]."', lastPoints='".$score."' WHERE gameID = '$up_gameID' " ) or die ( mysql_error() );
  32. //$sqlInsertWord = mysql_query( "INSERT INTO word_data VALUE( '', '".$up_gameID."', '', '".$xword[2]."' )" ) or die ( mysql_error() );
  33. /*$sqlCheckSK = mysql_query( "SELECT * FROM gameTileSkins WHERE gameID = '$gameID' AND email = '$up_email_player1' " ) or die ( mysql_error() );
  34. if ( mysql_num_rows( $sqlCheckSK ) == '1' ) {
  35.     $skUP = mysql_query( "UPDATE gameTileSkins SET tileSkin='$tileSkinID' WHERE gameID = '$gameID' AND email = '$up_email_player1' " ) or die ( mysql_error() );
  36. } else {
  37.     // INSERT gameTileSkins
  38.     $sqlSK = mysql_query( "INSERT INTO gameTileSkins VALUE('', '$gameID', '$up_email_player1', '$tileSkinID')" ) or die ( mysql_error() );
  39. }*/
  40.    
  41. mysql_query( some text here ) or die(mysql_error());
  42.    
  43. handle_query( some text here )
  44.    
  45. function handle_query($query){
  46.     mysql_query( $query) or die(mysql_error());
  47. }
  48.    
  49. sed 's/mysql_query/handle_query/g'  junk_code | sed 's/s*ors*dies*(s*mysql_error(s*)s*)s*//g'
  50.    
  51. // CHECK IF GAMEID EXIST FOR SCORE
  52. $checkData = mysql_query( "SELECT * FROM score WHERE gameID = '".$gameID."' " ) or die ( mysql_error() );
  53. $rcd = mysql_fetch_array( $checkData );
  54. $rcd['gameID'] == $gameID
  55. ? mysql_query( "UPDATE score SET score = '".$score."' WHERE gameID = '".$gameID."' " ) or die ( mysql_error() )
  56. : mysql_query( "INSERT INTO score VALUE( '', '".$gameID."', '".$player1."', '".$score."')" ) or die ( mysql_error() );
  57.    
  58. $sqlCheckRow = mysql_query( "SELECT * FROM wctilerack WHERE gameID = '".$up_gameID."' AND    email = '".$up_email_player1."' " ) or die ( mysql_error() );
  59. if ( mysql_num_rows( $sqlCheckRow ) == "1" ) {
  60. // INSERT wctilerack
  61. $sqlTileUP = mysql_query( "UPDATE wctilerack SET tiles = '$playerRack' WHERE gameID = '".$up_gameID."' AND email = '".$up_email_player1."' ") or die ( mysql_error() );
  62. } else {
  63. // INSERT wctilerack
  64. $sqlTileINSERT = mysql_query( "INSERT INTO wctilerack VALUE('', '".$up_gameID."', '".$up_email_player1."', '$playerRack' ) ") or die ( mysql_error() );
  65. }
  66.    
  67. eg:     mysql_query("INSERT INTO score VALUES ('', '".$gameID."', '".$player1."', '".$score."') ON DUPLICATE KEY UPDATE score = '".$score."'") or die ( mysql_error() );
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top