It's worth pointing out, in this context, that most serious WordPress based sites use various SEO plugins to manage things like SEO related meta tags, which all happens through PHP code.
Just in case anybody ever needs something to point at, to shoot down this kind of nonsense from incompetent SEO "experts" :)
User Profile
Collapse
-
I don't see anything in there that wouldn't be valid in PHP 5.
(Assuming this is being executed from withing a class method.)Leave a comment:
-
I agree, that each has their advantages.
1) Whether the conversion is done in MySQL or the actual code isn't really the point. It'll just be adding the complexity on another layer. For straight up SQL queries it's not a big deal but consider, for example, if you are building this on top of a framework that uses an ORM, or some other type of DBAL. (Which is fairly standard in the enterprise space.) In that scenario, calling a MySQL...Leave a comment:
-
I agree with you, RonB, on the 4x tinyint fields. I can see no practical reason for doing that.
However, while storing it as a uint vs string is better as far as storage space goes, in practice storing it as a string has some advantages.
- Generally IP addresses are used in their human-readable format, so storing it as a uint will require a great deal of conversion back from the uint format. That adds code complexity and a performance
Leave a comment:
-
Agreed, thus the rather lengthy discussion on that in the intro to the article.
However, what makes you say there is a "very high chance" of data corruption? - There are definitely downsides to storing binary data in a RDBMS, but that specific issue has never been a major one in my experience. (Barring charset issues and such, which would mess with all data, not just binary.)Leave a comment:
-
If the link is directing you to a "get_file.p hp", then that's what your list code must be printing into the anchor tag. PHP doesn't have a mind of it's own; it just does what you tell it to do.
Consider what would happen if I were go to this URL, given the above delete script:
Code:example.com/delete.php?remove_id=0+OR+TRUE
Code:DELETE FROM tbl_ficheiros
Leave a comment:
-
It's not shown there, but it obviously exists. You generally don't include all your code when asking questions on forums, just what is relevant.Leave a comment:
-
OK. Not much I can do without seeing the code. However, it's probably best for you if you don't post it in here. This comments thread is very long and uncomfortable for that purpose.
Instead, go to the PHP section and post a question there. (The big green button.) Describe the problem and post the code.Leave a comment:
-
When you say "row" I presume you mean "column"? Because otherwise what you said makes no sense.
This is simply a matter of changing the column name you are comparing the input value to, and treating the input value as a string instead of a number. - Honestly it's a fairly trivial thing to do; I'm not sure exactly how else to describe what needs to happen.
Have you tried this? If so, what have you tried?...Leave a comment:
-
Might have something to do with the size of the files. The DOCX file in there is significantly larger than the text files.
Try calling$result->store_result() ;
right after theif ($result)
in the get_file script.
I usually prefer PDO over MySQLi, so I'm not certain about this, but according to the MySQLi docs thenum_rows
function may not work correctly unless you store the result. If there is a size barrier on what it...Leave a comment:
-
There is nothing in the code that's specific to images, a part from the error message. In fact, the error message is wrong to specify it as an image. - I originally wrong this as an image upload script, but made it more general for the article. I seem to have overlooked rewording the error message.
It should work fine with any file type. I tested my original code with a bunch of non-image types. The mime type it provides during the download...Leave a comment:
-
Hey. So the second file is uploaded without error, is listed in the files list with a download link, but then fails to be downloaded saying the ID is invalid?
I see no reason why that would be happening with that code.
Are you sure the image is being uploaded correctly? Have you checked the database entry for it to see if everything is in order?Leave a comment:
-
If you want to monitor what's happening on the browser, that would require JavaScript. PHP can't interact with the browser, aside from generating the initial HTTP response content.
The first step of this would be to set the session mechanism up so it destroys the session after your desired timeout period. My above post explains how that works.
The second step - if you want every key and mouse interaction to refresh the session...Leave a comment:
-
Have you made sure that the image actually does exist in the database?Leave a comment:
-
Atli replied to writing a txt file is very slow using a php script using two tables linked with a comin PHPStart by posting your code. We can't really suggest improvements if we can't see what you have now.
One piece of general advice I would give you, when dealing with file IO, would be to use memory buffering wisely. An actual IO write operation is always expensive, so writing every character (byte) individually will be far slower than writing, say, a whole kilobyte of data in one operation.Leave a comment:
-
Why are you displaying table names onto the website like that?
Generally speaking, if you are using structure identifiers (table/schema/database names) as variables, then there is a big problem in your database design. The database structure should be static: it should never have to change dynamically.
For example, say you were trying to set up a forum. You would not create a new table for each sub-forum on the site (like...Leave a comment:
-
MySQL limits the max size of packets it can receive, using the max_allowed_pac ket directive. Depending on your server version, it can be either 1MB or 4MB by default.
If you want to submit binary files larger than that, you need to change this to a higher value in your MySQL server's configuration file. How exactly you do that depends on your platform. I suggest you use Google to find that out; it's a common question that has already...Leave a comment:
-
Yes, if you want to go with the name approach, you will have to fetch all three names out of the database. - Although, you could probably combine the three queries into one, if you understand subqueries and/or joins.
If you use an index in your GET parameter, instead of (or with) the name, then you'd only need one query. Consider:
Code:SELECT name FROM images LIMIT 1 OFFSET x
Leave a comment:
-
What exactly are you asking us to do?
What project are you talking about? What problem are you having starting it?
Presumably, having completed your PHP course, you understand the basics of creating PHP code? Given that, you should be able to at least attempt to start your project. Show us what you've done, and why/how it's gone wrong.Leave a comment:
-
Hey.
All you are doing there is creating Next and Prev links with the name of the image you are currently on. What you need to do is link to the next or previous images in the list.
Generally, you want to link to things like this using an ID or an index; a number that you can add or subtract from. That makes it far easier to create the links. All you'd have to do is add or subtract one from the current ID/index. - If you...Leave a comment:
No activity results to display
Show More
Leave a comment: