-
Posts
15,229 -
Joined
-
Last visited
-
Days Won
427
Everything posted by requinix
-
Long enough to remember the internet of yester-decade. I think it's made good progress since then.
-
There doesn't need to be a whole lot of rewriting. For example, mysql_num_rows becomes mysqli_num_rows. The two are very similar. Then there are others like mysql_free_result. mysqli has one too, but it's in the "statement" side of things and so is called mysqli_stmt_free_result. The other case is the ones that take the connection. mysql functions put it last, mysqli functions put it first. Additionally it's optional with mysql but required with mysqli. You can get, like, 99% done by looking at the mysql function name and finding a corresponding mysqli function name; it lists by the object-oriented method there (eg, mysqli_stmt::free_result), but the docs page will tell you about the procedural alias. The docs also have the arguments list - check that in case there's a difference in how the function is called.
-
If by "simply changing it to mysqli" you mean adding an 'i' in, well yes: while it's very similar to mysql, the biggest difference is that it takes the connection parameter first instead of last. But besides that it shouldn't be that hard. Which means the problem is dealing with the "doesn't work" aspect. What doesn't work, how, and what have you tried?
-
Setup site to automatically "create" urls using templates
requinix replied to jabbamonkey's topic in Other
You're trying to avoid having to keep track of every single thing/fruit, right? That's the problem you want to avoid. So a solution that involves having to track every single fruit probably isn't the right thing to do. Look into URL rewriting. What you will do is tell your web server (Apache) that you want to match a URL pattern and turn it into something else. The pattern looks like /Category/Subcategory1/Subcategory2/Item/Page, but I can't tell whether those three categories are fixed (always three) or not. But before you get there, you need a PHP page that can look up what it needs given the path. Like the Foods/index.php examples, except you should make the "Foods" generic too. As in index.php?cat=Foods index.php?cat=Foods&cat1=Fruits index.php?cat=Foods&cat1=Fruits&cat2=Apples index.php?cat=Foods&item=Red-Delicious When you make that work, then you can worry about setting up the URLs to work with the nicer-looking versions. However, if the three categories are not fixed then you have to do something different... -
A sure-fire way to become a good developer is to give up. But at least part of the blame lies on Google for featuring an article about downloading the Windows installer for Composer? Yeah, no. That's dumb. Don't do that. Find your composer.json file. It should be at or near the root of your project. Do you also have a composer.phar there? If not, do the Manual Download to get it. Then run it like php composer.phar update update will also redo the autoloads.
-
REST API responses when deleting records
requinix replied to NotionCommotion's topic in PHP Coding Help
Informing the user about the delete is the app's responsibility, not yours. If you want to provide an endpoint that lists "child" resources then you can do that, but otherwise once that DELETE comes in don't try to second-guess it. -
Nope. Note the "url" in those names. You're working with files, not URLs. Your question was whether to create the dump-autoload as a file or run it as code. If you've gone into the CLI documentation you should know how (a) what dump-autoload is, (b) that it is neither a file or code, and instead (c) how you are supposed to run it. dump-autoload is a "command" (argument) you give to the composer.phar application. That you should have a copy of... though you may not, actually, so if you don't then the first thing you have to do is download it.
-
Sounds like you need a starter course on what Composer is.
-
While that link may be helpful in the general case, it will do nothing to help your specific problem. No comment on whether that user is in the UK, or even in that same hemisphere, as they claim to be. You're looking at Composer autoload files. Don't do anything to them. Instead, tell Composer to regenerate all that data by running `composer dump-autoload`.
-
I'll wait five minutes for you to see this reply, then remove your account.
-
Seems you have a $db that's magically coming from... nowhere.
-
If imgroot had just joined then I would be leery too, but I think after ~280 posts they've earned some trust. Perhaps you could try aiming all of your posts in a more helpful direction and away from the critical and insulting?
-
The best way is to not do it yourself: sending 100k emails per day from a generic hosting company is a reliable way to get your server blacklisted and emails blocked. There are plenty of services that provide APIs.
-
USE WHICHEVER YOU WANT
-
Then That's not what Barand was asking for. The question is about the data type: DATETIME, TIMESTAMP, VARCHAR, whatever. On top of that is the question of how the values are getting to the database. You mentioned time() - is that what you're using? Or date()? Maybe MySQL's NOW()? And please, I know you think it's funny, but it's off-topic. It doesn't need to be here. I mean, it's not even related to programming. Maybe check out Miscellaneous?
-
Look at your variables. Make sure you're using the right ones in the right places.
-
Then what did you mean when you asked
-
PHP's time() function returns a Unix timestamp. It is the same value for everyone. You have to know something about where your user lives. With only PHP you can use geolocation on their IP address to get a good approximation. With Javascript you can get their "timezone" (UTC offset) with the Date object, which does not tell you their location.
-
Null session array condition not met until page is refreshed
requinix replied to makamo66's topic in PHP Coding Help
It won't print out anything because the code is invalid. We can't help you troubleshoot your code if you don't provide us with your real code. -
Apparently from the EXIF information that's embedded in the image. When you take a picture with most intelligent cameras now, they include metadata in the image about the orientation of the camera. Since the photo is always upright with respect to the camera, one can use the metadata to rotate the image so that it's upright with respect to the photographer. Unfortunately the camera (software) manufacturers didn't stop to consider that maybe the camera should automatically flip the image and then use EXIF to give the "original" orientation...
-
Side comment: the image orientation should be fixed right when it's uploaded, not when it's being displayed to the user.
-
php only works when i’m logged into wordpress.
requinix replied to davidhb21l6's topic in PHP Coding Help
1. What is the URL in your browser's address bar? 2. What do you see when you View Source the page? -
I can't tell what code is in what file. Try this with a post: Put the filename on a line, hit the Code <> button and put the file's code in there, and repeat for the other files. That way everything is clean and separate and has syntax highlighting and doesn't force me to scroll so much.
-
php only works when i’m logged into wordpress.
requinix replied to davidhb21l6's topic in PHP Coding Help
If you don't see it in the source then you added the code to the wrong template. Or you accidentally put it inside some block that's only outputted for logged-in users. Either way, needs to go somewhere else. -
For the record, if you're dealing with mobile devices then you can get GPS information - if the user allows you to do so. Non-mobile devices will give you information according to the IP address (user still has to approve), which will be more or less the same as the geolocation version. Basically, geolocation is only as good as a country and state. City is hit or miss.