I moved from twitter to Bluesky a few months ago and honestly, it's kinda delightful. The algorithm isn't at all as aggressive, the nazis are having a hard time fitting in, let alone taking over like they have on twitter, and not only is it hella easy to block people but blocking someone actually blocks them from your feed, again unlike twitter. Also, it's open-source so the likelihood of some fascist asshat like elon swooping in to buy it for nefarious purposes is low. Worth checking out imo.
maxxd

- 13 days ago
- Joined Nov 24, 2002
I agree it looks correct though could be slimmed down a bit if you wanted to - it's possible you could also just cut it to
return $_SESSION['userid'] ?? null;
PRG is much more important when you're doing e-commerce. There are several JS libraries for toast messages that can help with this as well - you can still give your user valuable feedback while wiping the $_POST variables. I've used toastr.js in past, but I'm sure there are good non-jQuery dependent solutions as well.
If you're using QuickBooks Online, they've got a native php SDK that might make your life easier.
Are you trying to do dynamic imports? Or is there another goal?
I've used Laravel Excel that implements PHPSpreadsheet and it was fairly straightforward. The only hitch I found was a php extension that wasn't installed by default on my server (sorry I can't remember what the package was, but it was simple enough to install).
This is from my php.ini:
592 ; Log errors to specified file. PHP's default behavior is to leave this value 593 ; empty. 594 ; https://php.net/error-log 595 ; Example: 596 ;error_log = php_errors.log 597 ; Log errors to syslog (Event Log on Windows). 598 ;error_log = syslog
Not to be pedantic, but VSCode actually doesn't claim to be an IDE - https://code.visualstudio.com/docs/supporting/faq#_what-is-the-difference-between-visual-studio-code-and-visual-studio-ide.
It does support in-app debugging; in the case of PHP through PHPDebug but that takes a bit of setup and, if I'm not mistaken, a plugin. If that's what you're asking about then there may have been a misunderstanding at the outset - probably mine, to be honest.
The whole point here is that VSCode is just an editor. Nothing more. It won't "run" your site, and it doesn't care where on your system PHP is installed beyond being able to provide hints and definitions as you code. And unless you've installed an SQL plugin, VSCode doesn't care a thing about your database.
As to the 'Add Image' function, I'm not really sure what that refers to. However, the

is pretty standard Markdown, which has been around since about 2004. In fact, this board uses it. Click the link button in the editor and you'll see almost exactly what you posted (the exclamation mark lets the interpreter know you mean an image, not a hyperlink).If your site is working on the same machine you're developing on, then it sounds like the confusion has to do with what you expect VSCode to do. If it's working on a different machine, then you need to heed Weedpacket's advice and check the setup on your local machine - something is different between the two systems.
It sounds like you've gotten used to doing things a specific way, which is very understandable. In the meantime, the world has moved on and you're just now getting shoved into it. I've been at this for ~25 years so I get it but I can tell you it's much better now then it was back then.
No, VSCode doesn't actually start a local server. You'll need to open a terminal window (again, I use Ubuntu via WSL2 - I assume you can use powershell or cmd on Windows base) and run
php -S localhost:8001
. You can also use the terminal built into VSCode to do this, I think. This will start PHP's built-in dev server, which you'll be able to hit in your browser at http://localhost:8001.As to the function not found, are you certain you've got the sqlsrv extension installed? Check the output of phpinfo() to make sure it's actually there. You may be able to use PDO intead, but I'm not familiar enough with sqlsrv to speak to that with any level of certainty.
I use VSCode daily on several different machines - to serve the site(s) locally I use either docker or php's built-in server (
php -s localhost:8001
) (either is started separately from a terminal). Granted, I use MySQL with Apache on linux-based environments (again via docker, through WSL2 on Windows, or OSX on Mac) so maybe there's something weird there. I do remember in eclipse you had to do a whole project location setup, but it's been long enough that I can't remember if that would then simulate a server or not. There's not - that I know of - a similar paradigm in VSCode; you open a directory and that becomes the working directory. Serving the site is a separate thing.Is your local server set up to serve php files and index as default? It sounds like it may be an apache or nginx config issue (not sure which server you're using locally).
I don't mean to be rude, but you're using Eclipse for php? In 2023? Skip it and use VSCode (free) or PHPStorm (not free).
Beyond that, it sounds like maybe you don't have a local server running - it's been a long time since I tried eclipse, but I think I remember you needed to set up a local server for it. Please don't hold me to that as I could very well be wrong.
Weedpacket The problem with using the submit button's value is that the string there is supposed to be UI text for the user; having it leak into your controller would mean extra work if someone down the line decides the button needs a friendlier label (or implements localisation for different users).
Valid point; I hadn't considered that. Maybe using a
button
element would be more appropriate in that case?As to
action
in Yii-land, yeah so far as I remember Yii's conventions dictate that a method be prepended with 'action' in order to fire automatically. So as in the example, the route/form/parse
would by default fire theFormController::actionParse
method. You can override this, but I believe that's the default. Full disclosure, it's been more than a couple years since I've had to deal heavily with Yii and even at the time it wasn't my favorite experience...As far as I recall, Yii bases the controller handling method on the URL; like
http://localhost/form/example
would callFormController::actionExample
. Either way, you'll need to set your form's action to a route that Yii can parse; in that form, create two submit buttons with the same name attribute. The 'Search' button should have a name ofsearch
and the 'Export' button should have a name ofexport
. Then in the controller's form submission method, run the appropriate method to the value of the submit button(s) index in the request array. Something along the lines of this:<form action="/form/parse" method="get"> <fieldset> <input type="submit" name="action" value="search"> </fieldset> <fieldset> <input type="submit" name="action" value="export"> </fieldset> </form> <?php class FormController{ public function actionParse(){ if($_GET['action'] == 'search'){ $this->searchResults($_GET); }elseif($_GET['action'] == 'export'){ $this->exportResults($_GET); }else{ //throw a 404 or something... } } }
I meant to respond to the
each()
deprecation thread, but honestly the point's the same...The book you're using includes this in it's blurb on amazon:
updated to incorporate the new features of PHP 5.1 and MySQL 5.1
PHP 7 is at end of life and 5.6 active support ended 6 years ago. I'd venture to say most of this book is obsolete by now and you probably need a more recent reference. I've not read the book, but this one is recent and has decent reviews.
- Edited
I've found PHP Intelephense to be pretty indispensable in my VSCode installs - be warned though, if you use primarily docker but not the remote connection plugin and don't have php installed locally, it will throw some warning at you. Although I may be one of few people that work that way.
Another tool I came across just the other day that may be helpful is PHP CS Fixer. I could well be just terribly behind the times on it and I've not used it yet, but it does look interesting.
Omit the dollar sign when calling an object property. So instead of
$jimmy->$pinn_number
, you'd use$jimmy->pinn_number
.There are some rather outdated things I see in the posted code (the use of
var
and snake case in variable and method declarations specifically); you might want to see if you can find a more modern tutorial.