How to calculate page views in Codeigniter [closed] - mysql

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 am looking to calculate how many times people have viewed my news on my site, and I don't know how to do that. I've searched at Google but I can't find an answer.
Is there any instruction on how to do this?

For the counter, codes may vary depending on your requirements.
Here's an example, 4 easy steps on how to make a counter.
To incorporate this with your website, include this on your controllers. I suggest have a main controller, which will be the parent and everything else will inherit the parent.
That should be on a custom function, and each function that provides "news/page" should call that visits counter function.

One possible solution may be as follows:
Create a table called visits in database ( contains only one row )
Include the file visits.php in all the pages you wish to track
visits.php
<?php
//connect to database
mysql_query("UPDATE visits SET no_of_visits = no_of_visits+1");
?>

Related

Which DB technology is sued to solve the following search issue? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
Assume I have built a video sharing site such as youtube, and I want to build a recommendation system.
Assume I have a simple database [ video title, link/url to database ]
Lets assume user watches a video simply tiled - 'Sachin Tendulkar'.
How can I run a query to return me other videos whose search title includes sachin tendulkar ?
eg: other videos could be titled -
Straight drive by Sachin Tendulkar or Sachin Tendulkars famous reply to Bret Lee.
In other words, which query can I run to fetch all the videos whose title contains Sachin ?
Practically any database should be able to run such queries.
In the case of SQL, using a simple WHERE ... LIKE ... condition with wildcards should be sufficient for simple cases.
The interesting question will be how to scale this once you are dealing with much larger amounts of data, think YouTube for video portals. But until performance really becomes an issue, adding additional complexity can most likely be considered premature optimization and should be avoided.

ebay api find out number of listings found [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 3 years ago.
Improve this question
I am trying to build a simple web application that tells the use how many ebay search results there is (like the google-fight.com but on ebay).
I got a developer account and know how to pass requests to the api and parse the result via JavaScript. My problem is that I can't find out to how to know the number of listing provided. All I find is:
paginationInput.entriesPerPage and paginationInput.pageNumber
the max value of each of them is 100 what can indicate for up to 10000 search results.
Theoretically I can jump to the 100 pageNumber and check how many entries there there and then calculate (99*100+number of entries on page). Of course its not good solution it takes a lot of calls and not effective with products with more then 10000 listings.
As you have not indicated in your question which eBay operation you are using I'm going to assume that you are calling findItemsAdvanced. If this is the case the total number of found items will be returned in the paginationOutput.totalEntries element.

can't save the edited html in a website [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 8 years ago.
Improve this question
I changed my profit amount in a live trading game with firebug but I can't save the amount which I changed.When I buy or sell the stock the profit is going back to the live rate,if there is any way for saving the changed amount ?
Not from Firebug. You are just editing the in-memory DOM of the page.
If you want to make it persist in your browser then you'll need write a browser extension that will modify the page every time you load it.
If you want to make it persist for everyone then you'll need to change the server to send the updated data. This could mean anything from just editing a file on the server to writing some server side code that can accept a request (over HTTP) to change data in a database and then use that data to generate the page each time it is loaded.

Voting system on NoSQL [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
Is it possible/reasonable to have a voting system on NoSQL database ?
For example how would be possible to store StackOverflow question into the NoSQL database.
I can easily imagine almost everything except how the relation will work between question/vote/user. Everything else can be stored in one document, like tags, comments(assuming there are relatively small amount of comments on posts, in my case I will not have comments anyway), user information, etc... but can't imagine how to store user votes as document will become huge. One of the options is that I can have votes stored in separate collection/document, but it will mean that while loading a question there will be a need to send another request to check if the user have voted for a question or not.
A good reference is the MongoDB documentation on Embedded documents vs Referenced documents, since those are what you seem to be referring into your question. There's no perfect solution, as both have their trade offs. You just have to make the best decision based on the type of operations/queries and their frequencies that you're expecting to be run on your database.
Honestly, until your database starts getting some serious traffic, the difference between SQL and NoSQL won't matter. Pre optimization can end up doing more harm than good, so I would just go with the one that is easiest to get deployed and you're more comfortable with to begin with.

What is the best way to implement a server database to be accessed from mobile apps (ios, android)? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I'm creating a mobile app to access journal articles.
They are organized by Volume -> Issue -> Section -> Article. This means that I will have 13 * 4 * 10 * 3 = 1560 articles. What is a good way to implement a database to host these articles (including their images, resources, etc) on a web server? Each article is currently marked up in HTML. I believe this is nice, because in my apps I will display the content in a web view. However, I'll need to query the articles for search functions, saving locally to the device, etc.
I'd prefer it to be open source, and as I'm new to databases (but fairly proficient in app development), I'd appreciate if you could point me toward the best way of learning.
I'm not sure if you are looking for advice concerning the structure but this might help you as an approach for further thinking:
create a table in which you write all the data
You have one column with a unique ID for each article
one column for each field of Volume, issue etc.
Then you have one column that contains a huge string in which you put the html data as a string. (There might be a better way especially concerning a search function)
You can also save it as a BLOB but this makes indexing a lot harder.
I would probably save the resources separated from the database. Then you just name them after the article id. For example resource number 10 in article 5 would be 5.10.pdf or whatever format. This depends on your html format of course. And whether you want to rename all your files (might be A LOT of work for 1500 articles)