Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

basic php save

Discussion in 'Multiplayer' started by kilik128, May 7, 2014.

  1. kilik128

    kilik128

    Joined:
    Jul 15, 2013
    Posts:
    909
  2. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    8,998
    Try if the SQL insert works from phpmyadmin? (put some values there)
    PHP:
    insert into scores values (NULL'$name''$score')
    then also try posting the score url manually, using browser to see what it does:
    (you could disable the hash check while doing that)
     
  3. kilik128

    kilik128

    Joined:
    Jul 15, 2013
    Posts:
    909
    thank's i have understand little better now and it's working
    it's because i get more one value on my table and i must set all in one


    ok now i have another think's where i must understand it's how change one existing value

    $query = "insert into scores values (NULL, '$name', '$pays','$score','$best','$play');";
    $result = mysql_query($query) or die('Query failed: ' . mysql_error());


    because here i add one value i just need update

    $query = "UPDATE into scores values (NULL, '$name', '$pays','$score','$best','$play') WHERE pays= '$pays'";

    i have sintax eror
    Query failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'into scores values (NULL, 'lol', '1','16','1','1') WHERE pays= '1'' at line 1
     
    Last edited: May 7, 2014
  4. nastasache

    nastasache

    Joined:
    Jan 2, 2012
    Posts:
    74
    The correct syntax for update is like: UPDATE tablename SET something=value WHERE condition.
    For example:
    $query = "UPDATE scores SET name = '$name', score = '$score' WHERE pays= '$pays'";