Jump to content


  • Posts

  • Joined

  • Last visited

  • Days Won


Community Answers

  1. maxxd's post in Template System was marked as the answer   
    We don't know what the rest of your code looks like, so it's difficult to say what's actually happening.
    My biggest question is is there a reason you're not using one of the many existing PHP template engines? Personally, I'm partial to Twig when not in Laravel land.
  2. maxxd's post in disfunctional while loop was marked as the answer   
    A more efficient way is to only select the 8 rows you're looking for instead of selecting the entire table.
  3. maxxd's post in Funky parameter activity was marked as the answer   
    In the commented out version, $column is between $where and $rule. So, when you use the second block of code on the commented-out version of get(), 'OREDER BY RAND()' becomes $column and $rule is blank.
  4. maxxd's post in PHP Error - unparenthesized issue was marked as the answer   
    PHP 8 requires parentheses when using nested ternary operations - https://lindevs.com/nested-ternary-operators-requires-explicit-parentheses-in-php-8-0/.
  5. maxxd's post in Calling an API and Testing within PHP (noobie help needed) was marked as the answer   
    You can use plain php curl, but honestly I think it'll be easier to deal with if you use Guzzle. I find it much easier, especially when dealing with passing tokens and keys and whatnot; as the docs say:
    $client = new GuzzleHttp\Client(); $res = $client->request('GET', 'https://api.github.com/user', [ 'auth' => ['user', 'pass'] ]); echo $res->getStatusCode(); // "200" echo $res->getHeader('content-type')[0]; // 'application/json; charset=utf8' echo $res->getBody(); // {"type":"User"...' Give it a shot and come back with code if something goes weird.
  6. maxxd's post in Why am I getting no response from my loginizer.php file? was marked as the answer   
    The data you're sending from AJAX doesn't include a 'submit' index, which loginizer.php requires to do anything.
  7. maxxd's post in Should you pass models directly to view - Laravel was marked as the answer   
    Personally I like to refine and/or finesse the data as necessary in the controller before it reaches the view. This sets up basically very dumb views where any business logic is taken care of before the view is rendered. However, part of the system I'm currently working on does pretty much what you describe and passes raw data directly to the view where it decides what to display and how and it works just fine. As requinix points out, some degree of coupling is pretty much unavoidable so I guess it depends on what's easiest for you reason about.
  8. maxxd's post in Checkbox reset not working - Wordpress customize Add Media was marked as the answer   
    Check boxes aren't be set in $_POST (so it won't be in $attachment, I believe) if they're not checked on the form. So, the isset() won't update the record if the user deselects the check box. What I'd recommend is get the existing post_meta for the record before you try to update. If the value exists, your system will know that the user has deselected the previously selected checkbox and you can delete the post_meta record. If the post_meta data didn't previously exist, then the user never has checked the box and you can skip the update.
  9. maxxd's post in In demo access to my site without authorization was marked as the answer   
    I assume you've got the authorization functionality working? So, instead of hitting the database and checking the user's access level or user role, just return the appropriate value to allow the user in thereby fooling the system into thinking the authorization mechanism returned true.
  10. maxxd's post in email form was marked as the answer   
    OK - is anything being displayed? Add
    <?php error_reporting(E_ALL); ini_set('display_errors', true); ?> to the very top of your script. Do you get an error before you try to submit the form? Or after?
    Just looking at it, it could be that you're trying to send an email to the literal string '$name' - single quotes in PHP don't allow variable parsing. Plus, they're not necessary in this instance.
    And all joking aside, please do check into some validation before you use the mail() function. You'll be glad for it later.
  11. maxxd's post in Uncaught SyntaxError: Unexpected token < in JSON was marked as the answer   
    Typically this happens when PHP outputs an error. Check your console and see what the output is from the server. Looking at your $queryForCheckInLijst, it may be a SQL error - it looks like you've added a couple column names without commas. I haven't looked through the rest of the code, but that's a place to start.
  • 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.