Deprecated: mysql_connect()

There are a few solutions to your problem. The way with MySQLi would be like this: To run database queries is also simple and nearly identical with the old way: Turn off all deprecated warnings including them from mysql_*: The Exact file and line location which needs to be replaced is “/System/Startup.php > line: 2 … Read more

Get the full URL in PHP

Have a look at $_SERVER[‘REQUEST_URI’], i.e. (Note that the double quoted string syntax is perfectly correct) If you want to support both HTTP and HTTPS, you can use Editor’s note: using this code has security implications. The client can set HTTP_HOST and REQUEST_URI to any arbitrary value it wants.

How to Set Category Page as Home Page in Prestashop

You are doing it the wrong way. Do it as followed: A) Easy but not recommended Way: 1) Open Controllers/IndexController.php 2) Modify function initContent as below : B) Recommended Way: 1) Copy Controllers/IndexController.php to override/Controllers/ folder 2) Open the copied file and edit as below: 3) Save the file and go to cache folder. Find class_index.php , … Read more

How do I get a file extension in PHP?

People from other scripting languages always think theirs is better because they have a built-in function to do that and not PHP (I am looking at Pythonistas right now :-)). In fact, it does exist, but few people know it. Meet pathinfo(): This is fast and built-in. pathinfo() can give you other information, such as canonical path, depending … Read more

How to force file download with PHP

I want to require a file to be downloaded upon the user visiting a web page with PHP. I think it has something to do with file_get_contents, but am not sure how to execute it. After downloading a file with header(location) it is not redirecting to another page. It just stops.

PHP – exit or return which is better?

Since you are using exit and return within the global scope (not inside a function), then the behavior is almost the same. The difference in this case will appear if your file is called through include() or require(). exit will terminate the program, while return will take the control back to the calling script (where include or require was called).

xajax expanding list query

I think you should look into jQuery as your default javascript library, it’s used by many web professionals and is very good. There you will find the Accordion control, which I think will suite this need very well. Good luck!

PDOException: SQLSTATE[HY000] [2002] No such file or directory

I have put PushChatServer dir in htdocs folder and create database puschat try to run @”http://localhost/PushChatServer/api/test/database.php“ Then I got following exception. I want do same thing to explain this link http://www.raywenderlich.com/32963/apple-push-notification-services-in-ios-6-tutorial-part-2 I have done all that but I got this exception Could not connect to the database. Reason: exception ‘PDOException’ with message ‘SQLSTATE[HY000] [2002] No such … Read more

How do I check if a string contains a specific word?

You can use the strpos() function which is used to find the occurrence of one string inside another one: Note that the use of !== false is deliberate (neither != false nor === true will return the desired result); strpos() returns either the offset at which the needle string begins in the haystack string, or the boolean false if the needle isn’t found. Since 0 is a … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)