0 Favourites

How do I insert with mySQLi?

  • 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?
  • Construct 3

    Buy Construct 3

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

    Buy 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)
Similar Topics Posts Views Last Post
Unread hot topic
99 10,152
karshinkoff's avatar
karshinkoff
Unread hot topic
56 4,735
MPPlantOfficial's avatar
MPPlantOfficial
Unread hot topic
0 Favourites
Why is Stencyl doing better?
44 16,857
Potato's avatar
Potato