Jump to content

chhorn

Members
  • Posts

    115
  • Joined

  • Last visited

  • Days Won

    2

Posts posted by chhorn

  1. so if you want to look at some variable, you have to find it first. the variable is "data", and i only see the code you posted, so you hit ctrl+f on this page and type in "data" without the quotes, the only place you find this combination of charaters is within this code

    		}).done(function(data){
    			form_status.find('.form-status-content').html('<p class="text-success">Thank you for contact us. As early as possible  we will contact you</p>').delay(3000).fadeOut();
    		});

    and the variable is provided as a parameter into a function. so you go into this function and place the code i posted there. and hit F12 in your browser, go to console, befor making that request.

  2. 19 hours ago, NotionCommotion said:

    does anyone have any feedback on using PostgreSQL with PHP

    coming from MySQL in the past, i'm working with PHP+Postgres nearly exclusive for the last 5 years or so. main reason is standards compatibility, so less surprises and less wasted time with debugging, but performance and built in features are also a cause, GIS capability is great.

  3. I bet you need the avatar more often, so a new table would involve a join or at least a separat query every time. so if your users table does not seem to be flooded with columns anyway, or the user can store multiple avatars, maybe for historical reasons, i would stick on two columns within the users table for performance and maintainability - you still can simply let the column out on queries that don't need the data.

    • Thanks 1
  4. I would recommend not to use this low level functions. At best you take a database with ACID compatibility, if you want to get a quick slim start, use SQLite, it's mostly build-in into PHP. But at least you can use json_encode(), file_put_contents(), file_get_contents() and json_decode() for your task, so you have clean and readable interface without thinking too much.

    On the other hand, file handling and format manipulation is a valuable lesson.

    But as already said, you have to tell us what problem you encountered in detail.

  5. As to the manual, "die" is an alias of "exit" which is a function, and there are examples in the manual which you should try on a standalone script first, so you learn how to call functions with the appropriate syntax.

    https://www.php.net/manual/en/function.exit.php

    Also i would recommend to not just randomly copy and paste function signatures into production code and hoping that they work as you expect, but actually learn how PHP works and what syntax is needed from the examples.

    • Like 1
  6. the DateTime class can handle a lot of default scenarious, including last x day of y, so all you need is the year and month component

    <?php
    
    $d = new DateTime('2019-10-01');
    $d->modify('last friday');
    print_r($d); // 2019-09-27
    
    $d = new DateTime('2019-11-01');
    $d->modify('last friday');
    print_r($d); // 2019-09-25
    
    $d = new DateTime('2019-12-01');
    $d->modify('last friday');
    print_r($d); // 2019-09-29

     

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