Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 04/06/2021 in all areas

  1. Don't run queries inside loops. Use a single query using JOIN(s) to get all the data you need. Example... SELECT t.id as ThreadID , title , LEFT(thread_body, 50) as body , date_format(threadtimestamp, '%D %b %Y %l:%i %p') as ftime , count(p.id) as num_posts FROM thread t LEFT JOIN post p ON t.id = p.thread_id GROUP BY t.id ORDER BY threadtimestamp DESC; +----------+----------+----------------------------------------------------+-----------------------+-----------+ | ThreadID | title | body | ftime | num_posts | +----------+----------+----------------------------------------------------+-----------------------+-----------+ | 2 | Thread 2 | Pellentesque porttitor, velit lacinia egestas auct | 6th Apr 2021 1:52 PM | 3 | | 1 | Thread 1 | Lorem ipsum dolor sit amet, consectetuer adipiscin | 5th Apr 2021 10:25 AM | 4 | +----------+----------+----------------------------------------------------+-----------------------+-----------+
    1 point
  2. when you exceed the post_max_size setting, both the $_POST and $_FILES arrays are empty, so, logic trying to use those values won't have anything to test. your post method form processing code should first test if a post method form was submitted. you can then compare the content-length (see $_SERVER['CONTENT_LENGTH']) value (which is in bytes) with the post_max_size (see ini_get('post_max_size') ) setting (which used to be in whatever units the setting is in - bytes or K, M, G short-notation, which may now be (unconfirmed) always in bytes due to the addition of the new Warning message for this condition) to produce your own error message. when on a live/public server you should set php's display_errors setting to OFF and set log_errors to ON to cause php error messages, which would include that new Warning message, to be logged instead of displayed.
    1 point
  3. So CPANEL is a dependency package that you've not included in your script. I don't use cPanel so I'm not sure how it's set up, but there should be a require or include directive in the script somewhere - either it'll include the script directly, or it'll include an autoloader file in which case you'll see a use statement naming the CPANEL class.
    1 point
  4. Unless someone here has specific knowledge about the sort of thing you're trying to do, we're not going to be able to tell you what's wrong unless you can describe what you're seeing. First thing to do is get more information. If you can't tell whether you can connect or not, that sounds like a good place to start. Maybe try some other, simpler cPanel operation to prove that the code is valid? Also see if you can get any logging or error messages that could indicate what's going wrong.
    1 point
  5. One of those two will work and the other will not. What will happen is, if you do the correct method then it will work, and if you do the incorrect method then it will not work.
    0 points
This leaderboard is set to New York/GMT-04:00
×
×
  • 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.