How do I insert with mySQLi?

0 favourites
  • 2 posts
From the Asset Store
This is a collection of 12 Combat Engines to insert, supplement, or replace conflict encounters for any game.
  • Hi guys,

    I'm trying to insert into a mySQLi DB, but nothing is happening This is my code:

    <?php
    $db = "db";//Your database name
    $dbu = "user";//Your database username
    $dbp = "pass";//Your database users' password
    $host = "host";//MySQL server - usually localhost
    
    $dblink = mysqli_connect($host,$dbu,$dbp,$db);
    if (!$dblink) { exit('Verbindung schlug fehl: '.mysqli_connect_error()); }
    echo 'Verbindung zum Host steht!';
         
    if(isset($_GET['name']) && isset($_GET['score'])&& isset($_GET['last_name'])&& isset($_GET['nickname'])&& isset($_GET['email'])){
         
         $name = strip_tags(mysql_real_escape_string($_GET['name']));
         $score = strip_tags(mysql_real_escape_string($_GET['score']));
         $last_name = strip_tags(mysql_real_escape_string($_GET['last_name']));
         $nickname = strip_tags(mysql_real_escape_string($_GET['nickname']));
         $email = strip_tags(mysql_real_escape_string($_GET['email']));  
       
         $string = "INSERT INTO sbo_scores (id,name,score,last_name,nickname,email) VALUES ('','$name','$score','$last_name','$nickname','$email');";
         $sql = mysqli_query($dblink, $string);
         
    }else{
         echo 'error.';
    }
    
    mysqli_close($dblink); //Close off the MySQL connection to save resources.
    ?>[/code:3ry24jy5]
    
    Any ideas?
  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Nvm, I fixed it.

    I removed all the "mysql_real_escape_string" statements.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)