How To Insert Data which is generated From Qt App into MySQL Database through PHP?
I Working on Qt where i need to insert data generated from Qt into the mysql database through php script. I am developing one Android Application so I have found this way only to insert data into mysql server through php?
I look forward for yours replies I'll be very thankful if help me out of this problem.
more than 2 weeks i am trying to this.
Do I understand you correctly: you want to store data in a MySQL server which is running on a remote server? Or do you have a local MySQL server (running on the same machine/device as your Qt App)?
@jsulm Server is running on Remote side
Does the server allow direct connection to the MySQL server?
@jsulm In Qt is not allowed that is why i am using php script. I am using WAMP Server.
I have done all thing ...... i mean to say that...... I have PHP Script which having two variables they stores $Name and $City field in the MySQL database.
But the doubt is that how can i store my qt application values to php variables ($Name and $city) so then php will insert into database.
@jsulm I am developing one android application in Qt.
Android application does not allow to interface with MySQL Server. It show error like "MYSQL Driver not loaded"
So I have searched a lot in google so there is only way to do this by php script
DO you know how to insert data from qt app in mysql through php script?
or else if you another way to insert data into mysql in android please let me know.
It depends. Does the server provide any kind of web interface to upload data? On the server you can have a PHP, Python, Java or what ever based web application running, which accepts for example HTTP POST requests to upload data, which it then stores in the SQL database. How exactly you upload the data depends on your server.
You can start here: http://doc.qt.io/qt-5/qnetworkaccessmanager.html
You can find guides that shows how to compile MariaDB client libraries for Android and use them to build the MySQL driver.
However it's not recommended to access a database server directly through internet so going through the web service route is a good plan.
You can use PHP Slim to build the web service.
Hope it helps
I'm new to QT and my first project was to do something similar you posted here where I've to add data in MySql database which is accessed by PHP file. What I did is I hosted my php file and MySql database on free php server from where I got the host ip address, database name, password.
In QT I used following to achieve the task of connecting PHP file and doing RESTfull CRUD operations using QT Visual Interface.