Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
I want to store and display recently viewed posts. I don't want to use cookies because not only want to show what the visitor him/her self viewed posts but viewed by others as well.
I know I can simply store post id in the table and display the data. But is this is best way to do this. As I understand this will store huge amount of junk data in the database as I only want to display 10 latest viewed posts on my website.
Can anyone tell me a better way to do this or is this the only way to do this?
Add a "dt_lastViewed" field to your "Posts" table. Update it when it's been viewed, and pull the top 10 for your module.
Optionally, create another field called "timesViewed" so that you can increment and track the most popular posts! May be considered YAGNI
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I'm just a beginner of PHP and I am working for making a multiple-choice type question paper. And I want to stores answers of these question in the database and also want to fetch result from database. And also I want to show result of attempt in percentage e.g. Your result is 40%.
I'm running PHP on WAMP server.
Welcome to Stack Overflow, we are here to help you correct your bugs and help you if you get stuck in coding. We are not freelancers, so please do not ask such questions which literally mean "do my homework!".
But hey, let me give you a basic info on how you should start up. First create a php page with form which contains all questions at once or like a wizard (depends on your needs). Later, you need to create a database, with two tables (maybe more) which are questions and answers. These shouldn't contains huge amounts of html chunks, but should be straight questions and answers with a foreign key to link them. Then use php to generate random questions and answers and use normal post/get (usually not user friendly) or AJAX (better performance).
If you get stuck in any of the steps above, then come back to StackOverflow and share your query with invalid codes and similar. Hoping this was helpful :)
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
i'm new to php/html5 etc and i want to create a simple ecommerce site.
I want to put button that will show the more detailed information of the product. My question is, if the button redirects the user to product page does this means i have to make a page for each products?. So, if i have 100 products i have to rewrite 100 page?, Is there a better approach to solve this? Sorry if this is a silly question. thank you
i'll just put random code here because the damned restriction
<?php
session_start();
include_once("shop-config.php");
include("header.php");
?>
A better approach would be to store the products as well as their description in a database, then have one page where you can request that information. I recommend looking into MySQL because it works natively with PHP and it's very easy to use. Once you get the basic queries down and an understanding of SQL, it shouldn't be a problem. :)
(I know this isn't much of an answer, but I don't have my computer on me now and for some reason I can't leave a comment because of my reputation. I guess it's better for new users to spam pseudo-answers than comment xD)
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
Help please create a form similar to a website.
How can i achieve a form like in this website www.myclean.com, i already got the first step in the form which is the slider and checkbox.
Now I need to know how to process that information and put it in the another page please try the form in this site www.myclean.com.
I can only think of php to do this get or post, do you have other ideas?
Thanks! :)
here is what I did in my slider and checkbox.
jsfiddle.net/z2zaz/9/
You can process the form in nearly any language you'd like, or you can email the results to yourself, but I'd recommend against that due to all the spam bots.
The language doesn't really matter. PHP is a fine solution, if that's what you're asking.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
I have a blog page on the site I'm creating (php/mysql). I generate blog posts by date created, most recent first. When you click the title of a post, you are linked to that post's unique page.
Problem example:
I click the tweet button on the post "Happy Holidays" on the page mysite.com/blog. The url it tweets is naturally mysite.com/blog. I want it to tweet mysite.com/blog/Happy Holidays.
How can I force a custom url to tweet? Do I have to meddle with the JS?
Simply provide a link in the following way.
http://twitter.com/share?url=http://mysite.com/blog/link
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
Im having a little trouble with a php script ive made.
you can see all the relevant info at http://click-media.co.uk/Client/Lisa/Admin/admin.php (password: "hey")
I basically need the classes to be ordered by day/time when a new class is created, either by changing the column names in the database to a timestamp or something or by making a new column to and ordering it by this.. then using the php to switch the order values when the admin clicks "moveup"/"move down" next to the row.
any help would be much appreciated.
Thanks
You can implement this by doing the following:
Add a column in the database and call it class_order
Your SQL query should have ORDER BY class_order
Moving up UPDATE table set class_order = THE_ORDER_OF_THE_CLASS_ABOVE WHERE id = TARGET_CLASS and UPDATE table set class_order = TARGET_CLASS_ORDER WHERE id = THE_CLASS_ABOVE
Moving down is the opposite of moving up