php5

Missing characters in parsed XML output with PHP5

I'm trying to parse the following XML file: <?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE content PUBLIC "-//BLACKWELL PUBLISHING GROUP//DTD 4.0//EN" "http://www.blackwellpublishing.com/xml/dtds/4-0/bpg4-0.dtd"&gt; <content dtdver="4.0" docfmt="xml"> .... <forenames>NIELS B&Oslash;IE</forenames><x> </x> At first it wouldn't lo...

Autogenerate array values with a loop?

I know this doesn't work but is there any way of autogenerating values? It can be pretty tedious to put so many values in specially if it's 50 or maybe 100 numbers... Here's the code so you get my idea: for ($num = 1; $num <= 20; $num++){ $arr = array($num); echo $arr[2]; }; Solved: It was the range() and arrayfill(). :) ...

Doctrine: Set model values as array

Hi, I've got an array of values I want to update my model with. Doctrine_Access provides a function setArray which is nearly exactly what I need - except it cares about values that don't have fields in the model. I want those to be ignored. A little example. Say we have a User table with the field username. $user = new User(); $user-...

Will using file_get_contents() to get files summing more than 1Gb from remote server, timeout?

On a http website, I have loads of csv files stored which chronological naming scheme. I wrote a PHP program (running on localhost) to programmatically generate each files name using date functions and use file_get_contents() to write the files locally. I have tested for a limited range of dates and am able to get the files (each around...

Internal Server Error 500 simplexml_load_file

if I use Firefox and access http://svcs.ebay.com/services/search/FindingService/v1 I get some sort of XML in respose, when I do that through PHP I get Internal Server Error 500 $ php -r 'print_r(simplexml_load_file("http://svcs.ebay.com/services/search/FindingService/v1"));' PHP Warning: simplexml_load_file(http://svcs.ebay.com/servic...

Simple AJAX Submit and update mysql

I am stumped, I am tossing out my code and I need help with a cross browser ajax submit. Can anyone PLEASE give me a simple working ajax submit script for updating mysql? The one I have is all bad. Works in FF and Safarai (iphone), but in IE7, it has caching problem and in IE8 it doesn't even submit. ...

Problem with WS-Security in PHP

Hi. I'm trying to connect to a webservice using WS-Security. I am currently using wsf/php library in generating the WS-Security header. The problem is i am getting a "the certificate used for the signature is not trusted" error. We have developed a java application that connects to the same service and uses the same certificate and ke...

Microsoft PHP SQL Driver 1.1

Hi, Will microsofts SQL for PHP driver version 1.1 work with x64 builds of php 5.3? It's not a general question as much as it sounds, we are currently having trouble with it. I just would like to know if someone can confirm if it works/should work or not. Thanks Jonas ...

How can I get the call stack from a Fatal Error?

I'm getting a fatal "Call to a member function on a non-object" error in a PHP script, but I'm unable to track down exactly where this is happening, or why. The error message is pretty-much useless, as the line it describes works 99.9% of the time. Is there a way I can get the current call stack, trace what calls are being made before t...

Is this efficient coding for anti-spam?

if(strpos($string, "PENIS") != false){ echo 'This word is not allowed'; } if(strpos($string, "VAGINA") != false){ echo 'This word is not allowed'; } Okay, so I am trying to check the submit data to see if there are inappropriate words. Instead of making 5 instances, is there a more efficient way? ...

Importing MS ACCESS DB to mySql?

I'm working on a project atm, and I need to import data that is stored in a MS ACCESS database to mySql. For mySql I'm using phpMyAdmin on a Ubuntu machine, I have another Windows Machine where I can access the Access DB from, In MS Access 2003 I can't find an option to convert the data to mySql? Can this be done? ...

Facebook application development - which option, and may I use jQuery?

I have read the documentations at Facebook. I have browsed through books on Facebook development and I am reeling from the options, restrictions. There is MockAjax, FBML, FBJavascript and the PHP API. And then there is an option of launching the application from inner frame. I guess there are 2 questions. When do you use the FB options,...

Create a page without placing .php at the end?

I was looking for ways to mimic something I've seen, however I'm really not even sure where to start or how to search for it. Lets say my page was: foo.com/ and my index page could take an argument of: index.php?id=5 What I'm wanting to do is create the following: foo.com/5/ rather than placing index.php?id=5 just use the webstring t...

Does PHP5 call __destruct() if you use a redirect?

I found that PHP5 isn't calling a __destruct() function if I have the following setup: class test { __destruct() { echo 'hehe'; exit; } } header('Location: http://test.com/'); exit; It never calls the destruct function ...

Calling a controller within a controller?

As far as best practices go is this recommended? I have a comments controller + model that needs to be called in an items and profiles controller. The comments controller automatically loads the comments model. Is it acceptable to call the comments controller directly from the items and profile controller, or is the "best practice" way ...

PHP PDO prepared statements

I was told today that I should really be using PDO and prepared statements in my application. Whilst I understand the benefits, I am struggling to understand how I implement them into my workflow. Aside from the fact that it makes code much cleaner, should I have a specific database class which houses all my prepared statements or should...

Yii Framework Resources

Yii is a nice php framework. (In my un-experienced view). I was wondering if anybody knows any good resources for it? This is a community wiki. Self described as a high-performance component-based PHP framework best for developing large-scale Web applications. It has a rich set of features, is purely objected orientated and has a growi...

PHP SimpleXML doesn't preserve line breaks in XML attributes

I have to parse externally provided XML that has attributes with line breaks in them. Using SimpleXML, the line breaks seem to be lost. According to another stackoverflow question, line breaks should be valid (even though far less than ideal!) for XML. Why are they lost? [edit] And how can I preserve them? [/edit] Here is a demo fil...

Dynamic Child Class generation - PHP

I have an abstract "object" class that provides basic CRUD functionality along with validation, etc. Typically I would use the __autoload($name) magic function to load a class that would exist in its own file, named the same as the class I wish to lazy load. The code would look something like this, which as you can imagine becomes quit...

query for checking database is already existing

how can i check if a database is already existing ...