Skip to content

CRON command to run URL address every 5 minutes

I’m newbie in cron commands and I need help. I have a script on http://example.com/check/. Whats is command for cron to run this URL every 5 minutes? I tried */5 * * * * /home/test/check.php …

How to run composer from anywhere?

I have just installed composer in my /usr/bin folder, so when from that folder I run php composer.phar I get the help info about composer. But, when I try to run the same from other folder I get Could not open input file: composer.phar. How to call php composer.phar from every where without problems? Answer c…

Return One Row from MySQL

Amateur question, but something I’ve been wondering about. What is the PHP for selecting one row from a MySQL query? AKA you’re picking something by unique ID (you know there’s only one row that matches your request) and want to get only that value. Do you still have to use a while loop and …

How to Check if value exists in a MySQL database

Suppose I have this table: I want to check if the value c7 exists under the variable city or not. If it does, I will do something. If it doesn’t, I will do something else. Answer preferred way, using MySQLi extension (supported from PHP 5 onwards): deprecated and not supported in PHP 7 or newer:

How to make files not shareable?

I am developing a website with php that is about uploading and selling/buying pdf documents. Of course, I need to program it in a way that makes it impossible (or at least very hard) to copy the purchased documents. Do you know of any mechanism to do this? Is it a programming issue or rather a pdf issue? Also…

Simulating a command shell output in a web browser

BACKGROUND: Right now, in our company we have a PHP based app to automate our report building. It works like this: A webpage with a form generates a ini file with some configurations that is saved localy a PHP CLI script accepts the ini file generated on step 1 and based on it, creates a directory with docume…

Fatal error: Declaration of .. must be compatible with .. PHP

I’m getting the following error: What could be the problem? I can’t find it script: Answer Ishoppingcart::addToCart() states that the method does not take any parameter, while the implementation Shoppingcart::addToCart(Product $product) requires that a parameter of type Product must be passed into…

show only limited categories with a MySQL queries

I have a mysql database in which there is about hundreds of category for photo album. When i display the album using so it will display the last 10 categories but if i want to display only 15 categories in between from that hundreds of category what the query should be? i have try this. here its displaying th…