I’m a newbie programmer trying to find my way in the world. I’ve got my hands on JSON data that I’m trying to parse out into SQL statements to populate multiple database tables. I would like to loop through each dimension of the array and pull out specific parts of it to create an INSERT sta…
Tag: php
PHP DOMDocument error Entity ‘nbsp’ not defined
I use DOMDocument for editing some HTML files, but some of theme have in their names spaces. So DOMDocument automaticly change the spaces to %20 and then can’t find them. This is how looks the error exactly: How to repair this error? Answer Use DOMDocument::loadHTMLFile() instead of load(). That’s…
failed to open stream: HTTP wrapper does not support writeable connections
I have uploaded my localhost files to my website but it is showing me this error:- What i personally feel that the contents get saved in a file in cache folder and when i uploaded the files to my web server it is trying to access the cached localhost folder. Answer Instead of doing file_put_contents(***WebSit…
Three curly brackets together in php source code
I just downloaded complete source code of PHP from php.net (PHP 5.4.0 [tar.bz2]). They are often using three curly brackets together as given below (The following code snippet extracted form ext/…
Submitting a form using
I’m having a little trouble with this and can’t see what I’m doing wrong. I have this form: So when the user clicks the button it should submit the form then have this PHP to act upon the form (I know that the sql isn’t a prepared statement and is vulnerable to injections but this will…
PHP $_GET/$_POST via variable variables
I’m attempting to dynamically access both the $_GET and $_POST arrays, among others, using variable variables. The reason I’m trying to do this is so that I can perform similar actions on multiple arrays without needing to declare specific iterations for each. I’m reasonably sure this is pos…
Get YouTube video title in PHP
In one of my applications I am saving a YouTube video’s id… Like “A4fR3sDprOE”. I have to display its title in the application. I got the following code for getting its title and also it’s working fine. Now the problem is if any error occurred (in case of a delete of the video) P…
glob() can’t find file names with multibyte characters on Windows?
I’m writing a file manager and need to scan directories and deal with renaming files that may have multibyte characters. I’m working on it locally on Windows/Apache PHP 5.3.8, with the following file names in a directory: filename.jpg имяфайла.jpg file件name.jpg פילענאַמע.jpg 文件名.jpg Testing on a l…
php array sorting with accents
I am using this to sort according to last name: But – when in last name is accent, e.g. Šiko, Áron, etc, these names are at the end. How can I sort it properly? Answer Use multi-byte string functions. There is a function called strcoll which seems to suit your needs. More info: On how to sort an array o…
Undefined variable: $_SESSION
I’m getting E_NOTICE errors in a core CakePHP file when it tries to reference a never-set or unset session (cake/libs/cake_session.php line 372): function read($name = null) { if (is_null($name)) …