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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.