Jump to content

sniperscope

Members
  • Posts

    280
  • Joined

  • Last visited

Profile Information

  • Gender
    Male
  • Location
    Osaka - Japan

sniperscope's Achievements

Regular Member

Regular Member (3/5)

0

Reputation

  1. if(isset($_POST['id'])) { mysql_query("TRUNCATE TABLE work"); $sql = "INSERT INTO work(staff_id, Mon, Tue, Wed, Thu, Fri, Sat, Sun) VALUES "; $counter = count($_POST['id']); for($i=0; $i<$counter; $i++) { $Mon = ($_POST['From1'][$i] == $_POST['To1'][$i]) ? '~' : $_POST['From1'][$i] .'~'. $_POST['To1'][$i]; $Tue = ($_POST['From2'][$i] == $_POST['To2'][$i]) ? '~' : $_POST['From2'][$i] .'~'. $_POST['To2'][$i]; $Wed = ($_POST['From3'][$i] == $_POST['To3'][$i]) ? '~' : $_POST['From3'][$i] .'~'. $_POST['To3'][$i]; $Thu = ($_POST['From4'][$i] == $_POST['To4'][$i]) ? '~' : $_POST['From4'][$i] .'~'. $_POST['To4'][$i]; $Fri = ($_POST['From5'][$i] == $_POST['To5'][$i]) ? '~' : $_POST['From5'][$i] .'~'. $_POST['To5'][$i]; $Sat = ($_POST['From6'][$i] == $_POST['To6'][$i]) ? '~' : $_POST['From6'][$i] .'~'. $_POST['To6'][$i]; $Sun = ($_POST['From7'][$i] == $_POST['To7'][$i]) ? '~' : $_POST['From7'][$i] .'~'. $_POST['To7'][$i]; $sql .= "('" .$_POST['id'][$i]. "', '" .$Mon. "','" .$Tue. "','" .$Wed. "','" .$Thu. "','" .$Fri. "','" .$Sat. "','" .$Sun. "'),"; } $sql = substr($sql, 0, (strlen($sql) - 1)); $sql .= ";"; mysql_query($sql); header('location: index.php'); }
  2. by the way i forgot to mention that my new server has php 5.4.10 and old one was 5.3.20
  3. Hello all Recently i have posting problem. I transfer my web page to new hosting server and since then i am facing problem with post data. I have a schedule form with 83 user which is posting one week schedule which means my form is posting 581 + (3 hidden form data) when i click Submit form. So far i have changed max_execution_time => 300 max_input_time => 600 memory_limit => 100M post_max_size => 80M upload_max_filesize => 80M in my previous server's values was 1/4 of above value and didn't have any problem even once. Output of my hidden value return NULL for testing purpose var_dump($_POST['test']); returns NULL even before and after form submission. Thank you for any help and/or idea Regards
  4. Different approach. Unfortunately, i cannot change db construction. What i want is list today's worker after 10pm and include everybody who works tomorrow. So, in my query bring today's and tomorrow's workers who works after 10pm.
  5. Hello i have a list in my database and i want to list them order by date and hour. Unfortunately my following sql query brings me wrong value. I need that display staff_id who works today and after 5pm and all from tomorrow. Example output should be like: |_Id_|___date___|__hour__| | 2 | 2013/4/18 | 22:00 | | 5 | 2013/4/18 | 22:30 | | 8 | 2013/4/18 | 23:30 | | 9 | 2013/4/19 | 00:30 | | 21 | 2013/4/19 | 00:30 | | 22 | 2013/4/19 | 01:00 | | 7 | 2013/4/19 | 01:30 | | 16 | 2013/4/19 | 02:00 | SELECT s.shop_name, g.staff_name, g.staff_id, w.staff_start, w.staff_end FROM work_master w LEFT JOIN staff_master g ON w.staff_master_id = g.staff_id LEFT JOIN shop_master s ON w.shop_id = s.id WHERE w.work_date BETWEEN '2013/4/18' AND '2013/4/19' AND w.staff_start >= '22:00' GROUP BY w.staff_master_id ORDER BY w.work_date ASC, w.staff_start ASC Above query gave me this output : |_Id_|___date___|__hour__| | 2 | 2013/4/18 | 22:00 | | 5 | 2013/4/18 | 22:30 | | 8 | 2013/4/18 | 23:30 | | 19 | 2013/4/19 | 22:00 | | 29 | 2013/4/19 | 22:30 | | 41 | 2013/4/19 | 23:00 | | 7 | 2013/4/19 | 01:30 | | 16 | 2013/4/19 | 02:00 | Appreciate for any help
  6. Hello Thanks for advice. Personally, i never store image files into database. The someone did it who built homepage at first and now i have to clean up his mess because he used php script to display images therefor, server has load problem
  7. Hello I am facing a problem like importing huge (2.5gb) sql file into new server. Super moron who create web page, saved image files into db. So first i have to import that sql file then convert image strings into image file. The first thing i thought open sql file and insert one by one but this time i have two problem; one: db is huge so text editors cannot open it and second there is about 80.000 records in it. How can i handle this task? Regards
  8. Dear Jcbones I am so thank you for that function. I even doidn:t know that php has so useful function. Okay, i guess i found what makes that problem. Seems, first loop cause it, at for($i = $start_hour; $i <= $mid_nght; $i += 1800) $arr[] = $i; So i remove it(commented) and than script throw me error on second loop. And i removed it as well, whoola page load fine. I do not want to touch to server's max_memory because this is at test now and if only visitor(me) make that much problem, i cannot imagine 1000 visitors at same time. So, i think, i have to re-think and optimize and re-create my codes from all over again.
  9. Yes that function belong to query class and i guess problem is array That function display some data at left side of side and it is include every single page.
  10. hello I am getting Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 32 bytes) in /home/accnt/public_html/connection/class_query.php on line 499 Code is below: i have no idea why is this happening... function WorkPanel() { $count = 0; $today = date("D", $this->Day1()); $day_change= $this->StoreInfo("day_change"); $arr = array(); $hr = date("H"); $min = (date("i") < 30) ? "00" : "30"; $now = strtotime($hr .":". $min); $sql = mysql_query("SELECT " .$today. " FROM work WHERE " .$today. " != '' AND area = '" .$this->area. "'"); while($row = mysql_fetch_array($sql)) { $working_hour = explode("~", $row[$today]); $start_hour = strtotime($working_hour[0]); $end_hour = strtotime($working_hour[1]); if($working_hour[1] >= "00:00" && $working_hour[1] <= "07:00") { $mid_nght = strtotime("23:59"); for($i = $start_hour; $i <= $mid_nght; $i += 1800) $arr[] = $i; array_push($arr, $i); $over_mid_start = strtotime("00:30"); $over_mid_end = strtotime($bitis); for($i = $over_mid_start; $i <= $over_mid_end; $i += 1800) $arr[] = $i; } else { if($working_hour[1] == "00:00") $mid_nght = "23:59"; for($i = $start_hour; $i <= $mid_nght; $i += 1800) $arr[] = $i; if($working_hour[1] == "00:00") array_push($arr, $i); } if(in_array($now, $arr)) $count++; unset($arr); } return $count; } Regards
  11. Hello I have some serious date and time problem and i am working on it for 3 days without any hope. On my current job day change at 07:00 and i cannot calculate to see if person working or not if his job end after 00:00 My current code work fine if current time until 07:00am but fail after it. // Find end hour $working_hour = explode("~", "10:00~01:30"); // Explode it to hour and minute $ending = explode(":", $working_hour[1]); $mid = ($working_hour[1] > "07:00" && $working_hour[1] < "23:59") ? 1 : 0; $end_hour = mktime($ending[0], $ending[1], 0, date("n"), date("d") - $mid, date("Y")); $current = mktime(date("H"), date("i"), 0, date("n"), date("d"), date("Y")); // Return result if($end_hour < $current) return "-"; else if($row['left_min'] > 0) return "You have " .$row['left_min'] ." minutes left"; else return "you are done"; However; yesterday i wrote some code which works perfect for single count but fail in loop. Here it is; $array_for_hour = array(); $working_hour = explode("~", "10:00~01:30"); // if job end after midnight if($working_hour[1] > "23:59" || $working_hour[1] > "00:00") { $start_hour = strtotime($working_hour[0]); $end_hour = strtotime("23:59"); // Add into array every 30 minutes for($i = $start_hour; $i <= $end_hour; $i += 1800) { $array_for_hour = $i; } // Add another 30 minutes to comlete to 00:00 array_push($array_for_hour, $i); $midnight_start = strtotime("00:30"); $midnight_end = strtotime($working_hour[1]); // Add hours into array from midnight to actual end hour for($i = $midnight_start; $i <= $midnight_end; $i += 1800) { $array_for_hour = $i; } } else { $start_hour = strtotime($working_hour[0]); $end_hour = strtotime($this->bitis_saat); if($end_hour == "00:00") $end_hour = "23:59"; for($i = $start_hour; $i <= $end_hour; $i += 1800) { $this->arr[] = $i; } if($end_hour == "00:00") array_push($array_for_hour, $i); } Thanks for any help and advise. Regards
  12. Dear Fenway. I am going to follow the path as i described in my previous post. Thank you so much for your attention and help. Have a nice day.
  13. yes sir. User password is all uppercase and i am 100% sure login credentials are correct
  14. My Password include lower/upper case and special character with 16 chars long and I Copy and paste from original connection string. Is that possible that something on server A or B is blocking communicate. Currently my servers has CSF firewall, iptables and ddos deflate. This is last thing i am thinking.
×
×
  • 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.