Skip to content

Tag: php

Validate PHP syntax in VIM

I would like to know how if it’s possible to validate if a PHP file is valid in VIM without closing VIM every time? Thank you Answer You can execute shell commands in vim. This is the same as calling php -l filename.php from the shell: I have this mapped into my ~/.vim/after/ftplugin/php.vim file so tha…

Extending ArrayObject in PHP properly?

Problem: I am trying to extend PHP’s ArrayObject as shown below. Unfortunately I can’t get it to work properly when setting multi-dimensional objects and instead an error thrown as I have the strict settings enabled in PHP. (Error: Strict standards: Creating default object from empty value) Questi…

In PHP, what happens in memory when we use mysql_query

I used to fetch large amount of data using mysql_query then iterating through the result one by one to process the data. Ex: Recently I looked at a few framework and realized that they fetched all data to an array in memory and returning the array. I would like to know the pros/cons of each method. It appears…

IMDB to MySQL: Insert IMDB data into MySQL database

I’m looking for a solution to import all the IMDB data into my own MySQL database. I’ve downloaded all the IMDB data files from their homepage which are all in the file format *.list (in Windows). I want to retrieve and that information and insert it correctly into my MySQL database so I can do some test and …

check for existing, persistent SQLite connection in PHP

PHP supports the use of persistent SQLite connection. However, problem arises in trying to run maintenance scripts (like file backup), with such a connection opened. These scripts are likely to be run without a server restart every now and then, on periods of low traffic. The question is : How to check if the…

php variable ask ques

My goal is to grab the name of a page by querying the page ID. And then store it in a variable. The current code I have for doing part of this is below, however as you can see the only thing I’ve done with the data is print it. CODE: OUTPUT: I want just the plaintext of the pagename

jQuery .post won’t read PHP include

I built my website from bunch of php include files that work like a template. When I change something in one file whole website changes. When I click on a radio button, ajax should activate and it should try to communicate with the other php file which should connect to the database and to send information ba…