[SOLVED] Help with INSERT INTO

General discussions related to php

Moderators: egami, macek, gesf

Post Reply
marasovec
New php-forum User
New php-forum User
Posts: 4
Joined: Tue Mar 20, 2018 9:56 am

Mon Apr 09, 2018 8:14 am

Hi guys,
Im trying to insert some data into my database but when I run this code

Code: Select all

$data = "something";

$conn = mysqli_connect('localhost', 'id5354650_hmm', 'password', 'id5354650_servers');
if (!$conn) die("error");

mysqli_query($conn,"INSERT INTO servery (data) VALUES ($data)");
Nothing happends. Its just empty.

Code: Select all

"INSERT INTO `servery` (`data`) VALUES ($data)"
doesn't work too.

Here is a screenshot of my database
https://prnt.sc/j2y5n6
Last edited by marasovec on Mon Apr 09, 2018 8:55 pm, edited 1 time in total.

chorn
php-forum Fan User
php-forum Fan User
Posts: 562
Joined: Fri Apr 01, 2016 2:18 am

Mon Apr 09, 2018 8:59 am

ask for errors: mysqli_error()

marasovec
New php-forum User
New php-forum User
Posts: 4
Joined: Tue Mar 20, 2018 9:56 am

Mon Apr 09, 2018 9:14 am

You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use...

Oh now I see! Thank you!

Post Reply