-
Posts
1,658 -
Joined
-
Last visited
-
Days Won
51
Posts posted by maxxd
-
-
Your connection string is incorrect. Also, turn on error reporting either in the script or (preferably for local development) in the php.ini.
-
Wrap your entire page structure in a div, give it display: flex, flex-direction: column, and min-height: 100vh. Give the header and footer a max-height and flex-grow: 0, then assign the body div a flex-grow: 1. Sticky footer with dynamic page height, and unless you're still supporting < IE 9, should be pretty universally cross-browser by now.
-
You're missing a semicolon on this line:
$data[$topic_parentid][] = array('id'=>$topic_id, 'name'=>$topic_title)
$data[$topic_parentid][] = array('id'=>$topic_id, 'name'=>$topic_title)
-
7 hours ago, Psycho said:
Look at the code examples on that page. The examples first create a datetime object with a specific timezone and then use gettimezone to retrieve the timezone that was previously set. A string such as "2021-05-06T13:48:19.2064951+05:30" has only the offset from UTC time - there is no timezone identifier. So, there is no way to programmatically determine the correct timezone out of the ones that share that offset.
Gotcha - I didn't read everything correctly. Thank you!
-
2 hours ago, Barand said:
One problem you will have is that for any offset there are usually several possible names. For your "+05:30" example there are only two but as the array below shows, there are usualy quite a few more ..
Legit question - does https://www.php.net/manual/en/datetime.gettimezone.php not handle that?
-
-
I'm not entirely sure what you're trying to accomplish with everything after the mysqli_query (also, you may want to look into PDO as it's much easier), but what does this give you:
die("<pre>".var_export($result, true)."</pre>");
if you put it right after the mysqli_query line?
-
PHP is a server-side language, so it only knows the timezone the server is in. As requinix says, you have to tell it what timezone to use. There are a couple different ways to do it - either ask the user or use a JavaScript library and pass the data to the PHP.
-
You'll need to look into AJAX.
Basically, using JavaScript you trigger a call (ajax or fetch) to a php script on your server - in the call you pass the selected value. The php script will use this passed value to determine what to show in the next drop-down and return that to the JavaScript which will then display that data to the user as a second drop-down.
-
You get the data to the server by submitting the form. You can do it traditionally or via AJAX, but either way the data has to be submitted to get to the PHP. I don't know cake, but if you normally get the request data via $this->request->getData() but it's empty in this case then something's wrong elsewhere.
-
There's probably a Cake-specific method of creating form fields with an array-enabled name, but I don't have the slightest notion what it would be.
To answer your other question, you'll need to submit the form data. Whether you do it via AJAX or a traditional HTML submit doesn't matter - send the data to the PHP script and process it there.
I'm not going to lie, given what you've described I'm hard-pressed to believe that what you're doing is actually what you want to do, but then again I don't know your project.
-
You haven't set a value for the drag12 element, so there's nothing for the JS to get.
-
The data you're sending from AJAX doesn't include a 'submit' index, which loginizer.php requires to do anything.
- 1
-
You can set the domain (and path, even) for cookies.
-
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
-
10 hours ago, phppup said:
echo '$var'; //indicates that you want the item in the quotes (which translates to a variable value, in this case) to be displayed.
10 hours ago, ajetrumpet said:this is literally the only thing you said that I wasn't aware of. thanks! I think that pretty much gives me everything I need. your words to describe what PHP does what that line of code was really what I was after, more or less. wonderful! 😃
Sorry, but this is completely incorrect. Single quotes in PHP will not interpolate variables, while double quotes will. So this:
echo '$var';
will output
$var
, and
echo "$var";
will output
value
-
I didn't read all your code, but on a macro-level you have a couple choices. Either get all the information on page load and use PHP to put it into JS variables or HTML data attributes, or use AJAX on the mouse over event and do it dynamically (slower, but IMO a better choice).
-
It looks like you're trying to combine cURL CLI and cURL php. They aren't interchangeable or compatible. Follow the link gw1500se gave you, then consider NotionCommon's advice.
-
37 minutes ago, Kell said:
$book = array("Moby Dick", "Wuthering Heights");
What you've done is create an array of strings. The Book objects that represent 'Moby Dick' and 'Wuthering Heights' are $first_book and $second_book. So this is what you're looking for:
$book = array($first_book, $second_book);
- 1
-
In your select query, limit the result by the user ID. I assume you're tracking user ID along with list item, yeah?
-
22 hours ago, paul_97 said:
The cron files when run from cmd are producing errors like to change to mysqli.
Perhaps consider changing to mysqli? Though, truth be told, PDO is easier...
-
It means that either the body property of your response object doesn't exist or isn't an object. Try putting this at line 11:
die('<pre>'.var_export($response, true).'</pre>');
-
If you're pulling data from WordPress but not using it as the CMS (so basically, it's headless) then your page doesn't know what to do with the WordPress functions you're calling. That's what I mean by mixing CMSs, you're relying on the PHPjabbers stuff to handle the bracketed text replacement and WordPress to hand the_posts(), the_title(), the_excerpt(), etc. Pick one - make sure you include the proper WordPress handler code, or use WordPress and include the PHPjabber script in the WordPress template file and use it there.
-
It looks like you're mixing CMSs? WordPress by itself doesn't understand mustache notation, so {SCMS_CONTENT_2} means nothing to it unless you're using a theme or plugin that parses that code.
1 hour ago, Strider64 said:You're not echoing out the content
the_title() will echo by default - you can turn echo off by passing false to the third parameter.
WAMPs or LAMPs or XAMPPs
in PHP Coding Help
Posted
I use docker for all my setups. Base your image on the official PHP image and go from there. Complete portability, as long as the host machine has docker installed.