dcsimg
www.webdeveloper.com

Search:

Type: Posts; User: Sodbuster

Page 1 of 6 1 2 3 4

Search: Search took 0.01 seconds.

  1. Replies
    12
    Views
    3,300

    The error message for number 2 doesn't match the...

    The error message for number 2 doesn't match the sql from your script. The message shows the fields with single quotes around them, even though the script doesn't add them. Did you forget to save the...
  2. Replies
    2
    Views
    695

    Just for safety's sake, use ">", rather than...

    Just for safety's sake, use ">", rather than "==". For instance, if you test for equality to 16 and some joker requests "index.php?image=17" you'd be in trouble. In other words, don't test for a...
  3. Replies
    5
    Views
    1,627

    If you're using Apache, setting an environment...

    If you're using Apache, setting an environment variable with setenv might be what you need. See http://httpd.apache.org/docs/2.2/env.html.
  4. Replies
    2
    Views
    643

    Two ways:...

    Two ways:
    date_default_timezone_set('America/New_York');
    $today = date('F j, Y, g:i a');
    date_default_timezone_set(ini_get('date.timezone')); // To reset

    // or

    $dt = new DateTime(null, new...
  5. I get the expected output: Befor return.After...

    I get the expected output:
    Befor return.After return. 1
    And now with require:
    Fatal error: Cannot redeclare myFunction() (previously declared in...info.php:4) in...info.php on line 8
  6. Replies
    2
    Views
    1,233

    I'd use curl, but with file_get_contents()...

    I'd use curl, but with file_get_contents() something like this might work (it's untested):
    $uri = 'https://commission-detail.api.cj.com/v3/commissions?date-type=event';
    $key = '123';...
  7. Replies
    10
    Views
    4,190

    I'm glad you solved your problem. I sometimes...

    I'm glad you solved your problem.

    I sometimes post complete code not as a complete solution, but for someone to adapt as needed, and as my small attempt to help someone learn more about PHP. The...
  8. Replies
    10
    Views
    4,190

    Here's a better use of DateTime: function...

    Here's a better use of DateTime:
    function dow_count_by_month($mo, $yr)
    {
    $dt = new DateTime($yr . $mo . '01 previous day');
    $dow_arr = array_fill(1, 7, 0);
    while ($dt->modify('next...
  9. Replies
    10
    Views
    4,190

    That actually gives op the solution he was...

    That actually gives op the solution he was looking for, which I see now mine won't (it will if $dt->format('N') < 6 is changed to $dt->format('N') == 5).
  10. Replies
    10
    Views
    4,190

    Short form using DateTime class: // Pass $yr as...

    Short form using DateTime class:
    // Pass $yr as 4-digit string, $mo as 2-digit string.

    function workdays_in_month($yr, $mo)
    {
    $dt = new DateTime($yr . $mo . '01');
    for ($d = $days = 0;...
  11. Replies
    5
    Views
    2,003

    If the line is blank, fgetcsv() will return...

    If the line is blank, fgetcsv() will return array(null) (which will resolve to true), not a "null array". So your code, Mindzai, will not skip over the blank line, but will produce $regis[0] => null...
  12. Replies
    5
    Views
    2,003

    It looks like the csv file was generated using...

    It looks like the csv file was generated using comma as the separator and double-quotes as the delimiter. So use fgetcsv(), which by default recognizes the comma and double-quotes, to read the file....
  13. Thread: Switch?

    by Sodbuster
    Replies
    2
    Views
    739

    I'd say that an if/else block is better suited...

    I'd say that an if/else block is better suited for this:
    $time = strtotime($datetime);
    if (($time < strtotime('1 December 2008') || ($time > strtotime('31 December 2009')) {
    $vat = '17.5%';
    }...
  14. Replies
    5
    Views
    938

    Those tutorials are either very old, or just...

    Those tutorials are either very old, or just plain wrong. If you want to install the stand-alone package, just follow the instructions in the PHP manual. It's really not that difficult for the newer...
  15. Replies
    5
    Views
    1,134

    If no $length argument is passed to fwrite(), the...

    If no $length argument is passed to fwrite(), the entire string will be written.

    I asked about the file being written because $fileDate is set to the past to force the file rewrite if $debug is...
  16. Replies
    5
    Views
    1,134

    Have you checked to see that the file is actually...

    Have you checked to see that the file is actually being rewritten each time?
  17. Replies
    6
    Views
    1,170

    That's correct. I should have said...

    That's correct. I should have said "$_FILES[$fieldname]['size'] should be an array for a multi_file upload."
  18. Replies
    6
    Views
    1,170

    $_FILES[$fieldname]['size'] is an array. As...

    $_FILES[$fieldname]['size'] is an array.

    As the manual says: "...$_FILES['userfile']['size']...will be a numerically indexed array of the appropriate values for the submitted files."
  19. Replies
    2
    Views
    737

    Your best bet: Change the space to newline....

    Your best bet:


    Change the space to newline.
    Read up on fputcsv() and fgetcsv(), etc.
  20. Replies
    9
    Views
    5,185

    There's also maintainability, extensibility, and...

    There's also maintainability, extensibility, and the possibility of an endless parade of unforeseen permutations. Regexps are great for some uses, but using them here would be what I'd consider the...
  21. Replies
    9
    Views
    5,185

    Using SimpleXML: $xml = new...

    Using SimpleXML:
    $xml = new SimpleXMLElement($doc); // $doc is the html document.
    foreach ($xml->xpath('//img') as $img_tag) {
    if (isset($img_tag->attributes()->style)) {
    ...
  22. Replies
    6
    Views
    1,057

    Put the pid into a hidden input. The way you have...

    Put the pid into a hidden input. The way you have it doesn't work, since the form inputs are added on to the action value, along with the question mark. The way you have it will produce somethng like...
  23. Replies
    7
    Views
    1,031

    Thanks, SyCo. I seem to have it stuck in my head...

    Thanks, SyCo. I seem to have it stuck in my head that that's the default.
  24. Replies
    7
    Views
    1,031

    There's also str_pad()...

    There's also str_pad().
    $a = str_pad($a, 2, '0');
  25. Replies
    2
    Views
    3,339

    If you read the dates your script prints out,...

    If you read the dates your script prints out, you'll see that Nov. 1st is listed twice. There are more than 86400 seconds in that day since that's when daylight saving time ends (in the U.S.). Try...
Results 1 to 25 of 150
Page 1 of 6 1 2 3 4
HTML5 Development Center



Recent Articles