Jump to content

Handling big data


sniperscope

Recommended Posts

Hi.

I have a user forum which user can enter calendar. Unfortunately, my code is not update/insert more than 10 users.

 

Here is my code for database query

 

Thanks for any help

 

<?php
session_start();
ini_set("post_max_size", "30M");

echo (int) $_SERVER['CONTENT_LENGTH'];	// Output is 24525

//$fp = fopen("sql.txt", 'a');
if(isset($_POST['UserData'][0]))
{
	for($i=0; $i<count($_POST['UserData']); $i++)
	{
		$UserData	= explode("_", $_POST['UserData'][$i]);
		$User_id	= $UserData[0];					//	User ID
		$User_day	= $days_no_kanji[$UserData[1]];	/*	Weekdays
														0 = Mon 
														1 = Tue .. etc */
		$User_work	= $UserData[2];					//	0 = INSERT  1 = UPDATE
		$User_start	= $_POST[$_POST['UserData'][$i] ."_start"];
		$User_end	= $_POST[$_POST['UserData'][$i] ."_end"];

		if($User_start != $User_end)
		{
			if($User_work == 0)
				$sql =  "INSERT INTO shukkin_master(shop_id, User_master_id, User_start, User_end, User_date) VALUES('" .$_SESSION['id']. "', '" .$User_id. "', '" .$User_start. "', '" .$User_end. "', '" .$User_day. "')";
			else
				$sql = "UPDATE shukkin_master SET User_start = '" .$User_start. "', User_end  = '" .$User_end. "' WHERE User_master_id = '" .$User_id. "' AND User_date = '" .$User_day. "'";
		}
		else
			$sql = "DELETE FROM shukkin_master WHERE User_master_id = '" .$User_id. "' AND User_date = '" .$User_day. "' LIMIT 1";
		//fwrite($fp, $sql."\n");
		mysql_query($sql);
	}

	header('location: index.php?e=0');
}
//fclose($fp);
?>

Link to comment
https://forums.phpfreaks.com/topic/265072-handling-big-data/
Share on other sites

Here is table structure I got it from export menu.

 

CREATE TABLE shukkin_master (

  shukin_id int(13) unsigned NOT NULL AUTO_INCREMENT,

  shop_id int(5) NOT NULL,

  User_master_id int(10) DEFAULT NULL,

  User_start varchar(5) NOT NULL COMMENT '00:00',

  User_end varchar(5) NOT NULL COMMENT '00:00',

  User_date int(10) NOT NULL,

  PRIMARY KEY (shukin_id)

) ENGINE=MyISAM  DEFAULT CHARSET=utf8;

Link to comment
https://forums.phpfreaks.com/topic/265072-handling-big-data/#findComment-1358360
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.