Jump to content

silkfire

Members
  • Posts

    569
  • Joined

  • Last visited

Everything posted by silkfire

  1. Sigh Gareth...echoing HTML with PHP is a nasty habit. And people think you're trolling, too.
  2. I figured it out. ON DUPLICATE KEY UPDATE does not allow a WHERE clause.
  3. I made this query and looked through the manual and as far as I'm concerned can't see what's wrong with my query. Why are MySQL errors so extremely unhelpful? Surely they could've improved the parsing engine by now? INSERT INTO `$batch_comments` (`plant`, `sap_code`, `batch`, `reason`, `comments_sm`, comments_sc) VALUES('SE23', 'PAN-6587', '165701C~', 'wohooo', '', '') ON DUPLICATE KEY UPDATE `reason` = 'wohooo', `comments_sm` = '', `comments_sc` = '' WHERE `plant` = 'SE23' AND `sap_code` = 'PAN-6587' AND `batch` = '165701C~'
  4. Gareth, I can help you out by email. G
  5. Dunno but your logic seems a bit flawed. 1. "SELECT `level` FROM users WHERE `level` = 1" does not make sense. That will give you a bunch of 1's. 2. If you only pick those users with admin privileges, then why do you need "if ($admin)" in the first place?
  6. Well if you know admin is level 1, why don't you just make a query: ...WHERE `level` = 1. I don't see the difficulty in this?
  7. That's what you use the great abundance of string functions you find in PHP for. In this case you are to extract a substring of 200 characters from your string: echo substr($row['intro'], 0, 200)
  8. A little tip from me: Always start the date from 1, because that day is guaranteed to exist in any month any year. January 31 + 1 month is 2 March, so it will skip February.
  9. What do you mean by "style XML" ? XML is pure information in tags, this is not HTML. I suggest you insert all the data into a temporary database table, then select the data and sort on Approved_On column.
  10. 1. There's no way for the user to delete or change the picture any way, why are you worried? 2. Ye, try that.
  11. You can store that data in a separate attribute starting with 'data-': <a id="...." href ="......" data-number="1234">.......</a>
  12. If your using jQuery don't use inline JavaScript. It has a css selector engine that enables your code to be separated from your markup. Exactly. Using "onclick=" attribute was popular in early 2000s but now with jQuery that is completely unneseccary.
  13. Don't feed the troll
  14. This has nothing to do with what the first day of the week is... I just ran your code and got this: string '2012-05-14 00:00:00' (length=19) // Last Monday string '2012-05-20 23:59:59' (length=19) // Last Sunday What results do you get today, Monday, 21 May?
  15. You should probably use AJAX with jQuery for this not dump variables into the attribute of the link.
  16. 1. Do you want the pictures uploaded not to be accessible by users? When you upload a file to the server it's stored in a hidden temporary file so don't worry about that. By moving the file from the temporary location to a place the user cannot access it you have control over where the file resides on the server. 2. Are you using Windows? Probably you need to have write access to the parent folder.
  17. Your regex is malformed. Plus these type of questions we have a specially dedicated Regex forum for. Use this instead: ([\d.]+)%
  18. Try cutting of the last 6 chars: $string = substr($string, 0, -6);
  19. I think those are NUL characters (ASCII code 0x00), replace them like this: $string = str_replace(chr(0), '', $string);
  20. You actually don't need to use the doRequest method. SOAP automatically creates all functions in the WSDL for you when it parses the specification. So just pass all the data as an array argument to the function: $client->SubmitRequest(array( 'MTID' => 'xxxx', 'Amount' => 0, 'Currency' => 0, 'SuccessURL' => 0, 'FailureURL' => 0, 'CancelURL' => 0, 'ProcessingURL' => 0, 'Shipping' => 0, 'Language' => 0, 'CustomerName ' => 0, 'CustomerEmail' => 0 ));
  21. You need to use SOAP. There are many tutorials out there, just Google.
  22. xyph he's not interested in the output he needs the array as a base for his chart, probably in JavaScript, as an object/array.
  23. Okay I see what the issue is; you first need to find out first month and the last month. CODE: list($month_start, $year_start, $month_end, $year_end) = mysql_fetch_row(mysql_query("SELECT (SELECT periodMonth, periodYear FROM measureTemp WHERE practiceID = '$_SESSION[practiceID]' AND questionRecID = 1 ORDER BY periodYear, periodMonth LIMIT 1), (SELECT periodMonth, periodYear FROM measureTemp WHERE practiceID = '$_SESSION[practiceID]' AND questionRecID = 1 ORDER BY periodYear DESC, periodMonth DESC LIMIT 1)")); $measureArray = generate_month_range($month_start, $year_start, $month_end, $year_end); $asthma5_40Query = "SELECT measure, periodYear, periodMonth FROM measureTemp WHERE practiceID = '" . $_SESSION['practiceID'] . "' AND questionRecID = 1 ORDER BY periodYear, periodMonth"; $asthma5_40Res = mysql_query($asthma5_40Query); while($row = mysql_fetch_array($asthma5_40Res)) { $measureArray[$row['periodYear']][$row['periodMonth']] = $row['measure']; }
  24. What are you trying to do? In what form do you need the chart data?
  25. Nice. What you need is to generate an array with years and months of that range (the entire range), then fill the corresponding keys with the values from database table. This means keys in the range that were never filled will stay there, but empty. I made a function for you. function generate_month_range($month_start, $year_start, $month_end, $year_end) { $array = array(); $start_time = mktime(0, 0, 0, $month_start, 1, $year_start); $end_time = mktime(0, 0, 0, $month_end + 1, 1, $year_end); $months_count = round(($end_time - $start_time) / 2629743); for ($m = 0; $m < $months_count; $m++) { $date = strtotime("+$m months", $start_time); $array[date('Y', $date)][date('n', $date)] = ''; } return $array; } echo '<pre>', print_r(generate_month_range(5, 2010, 9, 2011), true), '</pre>'; Will result in this array with empty values (example code is from May 2010 to Sep 2011, months are numeric!): Array ( [2010] => Array ( [5] => [6] => [7] => [8] => [9] => [10] => [11] => [12] => ) [2011] => Array ( [1] => [2] => [3] => [4] => [5] => [6] => [7] => [8] => [9] => ) )
×
×
  • 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.