logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: apache - mysql only taking some data
Author
bgengine



Joined: 30 Apr 2019
Posts: 3
Location: ireland

PostPosted: Tue 30 Apr '19 14:26    Post subject: apache - mysql only taking some data Reply with quote

Hi
I have a Raspberry Pi with Apache and Marai / mysql installed.

I have a store.php file on this server.
I call this PHP file on my remote device and use it to save data to the MYSQL database

(INSERT INTO `P4`(`Time_Stamp`, `Location`, `Readings`) VALUES ("2019-04-29 19:24:25","WaterPump",0.00))

this store.php file is called every 2 seconds automatically by my remote device.

For some reason this works for 30 minutes :
the Store.php will return the following each time.

200
Connected successfully
!!!!INSERT INTO `P4`(`Time_Stamp`, `Location`, `Readings`) VALUES ("2019-04-29 19:05:37","WaterPump",0.00)
<h1>THE DATA HAS BEEN SENT!!</h1>


The "200" tells me the data was store successfully.

.....But after 30 minutes I get the following..

500
Connected successfully
!!!!INSERT INTO `P4`(`Time_Stamp`, `Location`, `Readings`) VALUES ("2019-04-29 19:05:37","WaterPump",0.00)


the "500" tells me I have an "Internal Server Error ".

However after another 30 minutes .. it start working again - with oput me doing anything to fix it ... but only for another 30 minutes .. this keeps repeating every 30 minutes.

I'm new to Apache / mysql so am not very familiar with this .. can any suggest what my problem might be ?

thanks
Back to top
spser



Joined: 29 Aug 2016
Posts: 97

PostPosted: Tue 30 Apr '19 15:01    Post subject: Reply with quote

SHOW CREATE TABLE `P4`;
Please send the table structure information

Ps: In addition, your code should be added to the error correction function. Refer to the following code.

Code:

$sql = 'INSERT INTO `P4`(`Time_Stamp`, `Location`, `Readings`) VALUES ("2019-04-29 19:24:25","WaterPump",0.00)';
if ($mysqli->query($sql) === TRUE) {
    printf("successfully\n");
}else{
   printf("Error: %s\n", $mysqli->error);
}
Back to top
bgengine



Joined: 30 Apr 2019
Posts: 3
Location: ireland

PostPosted: Tue 30 Apr '19 16:11    Post subject: Reply with quote

Ok, thanks for your responce... I'll get this added information and post it here when I get home . thank so much
Back to top
bgengine



Joined: 30 Apr 2019
Posts: 3
Location: ireland

PostPosted: Tue 30 Apr '19 19:27    Post subject: Reply with quote

Hi, is this what you are looking for ?


Your SQL query has been executed successfully.

SHOW CREATE TABLE `P4`



P4

CREATE TABLE `P4` (
`id` mediumint(9) NOT NULL AUTO_INCREMENT,
`Time_Stamp` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`Location` varchar(10) NOT NULL DEFAULT '',
`Readings` float NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=59708 DEFAULT CHARSET=utf8mb4
Back to top


Reply to topic   Topic: apache - mysql only taking some data View previous topic :: View next topic
Post new topic   Forum Index -> Apache