Insert data to mysql database
NickName:user5056294 Ask DateTime:2015-07-21T19:26:37

Insert data to mysql database

I want to insert data from android to mysql database This is php code

$connect = mysqli_connect("localhost","root","123423","jacccccttt");

if(mysqli_connect_errno($connect))
{
    echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
else
{
    echo "success";
}

$name = isset($_POST['name']) ? $_POST['name'] : '';
$message = isset($_POST['message']) ? $_POST['message'] : '';

$query = mysqli_query($connect, "insert into users (name, message) values ('$name' ,'$message') ");

mysqli_close($connect);
?>

Just I want android project to post name and message to my php file.

Copyright Notice:Content Author:「user5056294」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/31537740/insert-data-to-mysql-database

More about “Insert data to mysql database” related questions

Insert data to mysql database

I want to insert data from android to mysql database This is php code $connect = mysqli_connect("localhost","root","123423","jacccccttt"); if(mysqli_connect_errno($connect)) {

Show Detail

Java mysql insert jtable multiple data to mysql database

I am trying to create a cart using jtable in java. I know how to insert data from mysql to show on jtable. I want to insert a product on jtable where I can select an item to void the item or chan...

Show Detail

Unable to insert form data in MySQL database

I am using following php script to insert data in my MySQL database.But no rows are getting inserted..when I run same sql query in phpmyadmin its working fine. <?php if(isset($_POST['submit'])...

Show Detail

How to read a data file and insert data into a mysql database

I am new to Java and I'm trying to insert data into a mysql database using a text file. My text file has 5 rows. I have 3 SQL insert Queries. Each query will insert 5 rows into the database. E...

Show Detail

About Insert data to mysql database

CODE: import mysql.connector from bs4 import BeautifulSoup import requests URL = "https://parade.com/937586/parade/life-quotes/" web_page = requests.get(URL) soup = BeautifulSoup(web_page.

Show Detail

MySQL/PHP check if data is in database table, if not insert it

I'm having an issue checking if the data I entered is already in the database table and if it's not then inserting it into the table. What I can't figure out is how to get the id (it is primary an...

Show Detail

insert data into mysql database with PDO connection and insert with oop

i try to insert data into mysql database. i created PDO connection with mysql and now i want to insert data into database with oop. i tried a million ways but without result. could anyone please h...

Show Detail

insert data into mysql database - java eclipse

i have this code to insert data into mysql db, when i run on eclipse the following code it doesn't show any errors but no data are inserted into the db. this is my code. public static void main (S...

Show Detail

Unable to insert multiple data into MYSQL database

I am unable to insert the data entered in the text box into MYSQL database. I am trying to insert inputs from multiple textboxes into the database. <?php include('questionDB.php'); if(isset($_P...

Show Detail

Insert data to a table in mysql database

i'm trying to insert my data to mysql db it don't give me any Error but it send null data instead of my data to db table. i can't find why it doesn't run correctly. this is the snippet code: import...

Show Detail