I'm new to xpath and am running into troubles with PHP's ancient XPath implementation. Is it correct, that //@url is just the abbreviated form of //attribute::url? I'm trying to query the flickr rss for testing, but the abbreviated query finds the correct nodes, whereas the verbose one returns 0 elements:
$xml = file_get_contents('http:...
Hi
I am resizing an image that is uploaded and I am creating a new image after resize using the function imagecreatefromjpeg()
I have been able to successfully resize images of huge dimensions as well.
But when I am try and upload an image having a size above 1.5 MB or so, I get the following error
Fatal error: Allowed memory size o...
run.php is just a normal PHP file:
[root@www4 robot]# php run.php
No log handling enabled - turning on stderr logging
Cannot find module (HOST-RESOURCES-MIB): At line 0 in (none)
Cannot find module (HOST-RESOURCES-TYPES): At line 0 in (none)
Cannot find module (UCD-DISKIO-MIB): At line 0 in (none)
Cannot find module (TCP-MIB): At line ...
Update mysql with $_POST data from while loop
I'm trying to get this round my head, but i am failing quite hard :[
I have 3 rows in a database which i am echoing out in a while() loop.
A user can change search_terms and then save the fields in mysql, however i don't quite know how to do this, as there are 3 rows, so i can't just do;
<...
I trying to write a php page that will take url values and insert them into an xml file. Any sample files would be of great help.
...
Hi,
I'm using Zend Framework 1.8. I have a problem with headMeta() duplicating my meta keywords.
In my layout.phtml, I have
<?php echo $this->headMeta(); ?>
I have a Custom Controller_Plugin_ViewSetup (extending Zend_Controller_Plugin_Abstract) that has the following code in it, in the dispatchLoopStartup() function:
$view->h...
Is there an efficient way to update a selection of rows' field to 0, but set One of these rows to 1 based on an ID.
Basically, I have multiple objects in a database, and I want to toggle between which one is "inuse", so the query will set one of the rows (by id) to inuse=1 and the others to inuse=0.
Thanks :)
...
I have a script that requires the postcode input to have a space in it, if not it will fail. Straight forward, but UK postcodes can have gaps in different places, i.e W1 4SB, NW2 6PT or SG14 1LB how would I change users input, if there is no gap entered to the correct format using PHP?
...
Hi all,
I'm using Zend_Validate to validate some form input (Zend Framework version is 1.8.2). For some reason, using the Zend_Filter_Input interface as described here does not work:
$data = $_POST;
$filters = array('*' => array('StringTrim'));
$validators = array('driverName' => array('NotEmpty','messages' => 'This should override the...
Many programming languages has a coalesce function (example). PHP, sadly, does not.
What would be the most efficient way to implement one in PHP?
...
I'm currently using PHP and a regular expression to strip out all HTML comments from a page. The script works well... a little too well. It strips out all comments including my conditional comments in the . Here's what I've got:
<?php
function callback($buffer)
{
return preg_replace('/<!--(.|\s)*?-->/', '', $buffer);
}
...
Hello
I am trying to parse XML using PHP DOM and then insert this data in MySQL tables, i am using the following code for this:
<?php
$xmlDoc = new DOMDocument();
$xmlDoc->load("testrtap11.xml");
mysql_select_db("zeeshan_database1", $con);
$x=$xmlDoc->getElementsByTagName('RECORD');
$z=$xmlDoc->getElementsByTagName('TITLE');
$w=$xmlD...
I'm using a framework that loads the table structure from the database everytime I open a page. I'm thinking of using JSON files to cache this data, and let PHP parse them when I need it. Is it better than loading data from the database? Are there another ways to do something similar?
...
[root@file nutch-0.9]# ls resume/
crawldb index indexes linkdb segments
like the above example,
how to get number of sub files(can be file or directory) in PHP?
...
I have two php files in the same directory:
test.tattler.php
class.tattler_stats.php
My test.tattler is supposed to create an object of my tattler_stats but it gives me this error:
Fatal error: Class 'tattler_stats' not found in /.../test.tattler.php on line 4
Code in test.tattler:
<?php
include 'class.tattler_stats.php';
$tatt...
I'm trying to make a WordPress site that has six lists on a page, each list showing posts from a different category. Simple.
But then, if a user selects a tag, taking them to that tag archive page, I want them to still see the six-list template, but all the posts within each category are also filtered by the tag. So lists of posts are f...
When reading online discussions about MVC frameworks, I hear a lot of commentary pointed toward PHP projects like Cake, Code Igniter and Symfony from Java/.NET developers in the vein of "those are clever hacks, but not true MVC".
So, what makes something a "true" MVC framework. i.e. what's an example of a .NET or Java MVC framework th...
Hello!
I would like to implement Latent Semantic Analysis (LSA) in PHP in order to find out topics/tags for texts.
Here is what I think I have to do. Is this correct? How can I code it in PHP? How do I determine which words to chose?
I don't want to use any external libraries. I've already an implementation for the Singular Value Deco...
You can pass a boolean to json_decode to return an array instead of an object
json_decode('{"foo", "bar", "baz"}', true); // array(0 => 'foo', 1 => 'bar', 2 => 'baz')
My question is this. When parsing object literals, does this guarantee that the ordering of the items will be preserved? I know JSON object properties aren't ordered,...
Hello there,
I am having trouble with an SQL query that I have inserted into a piece of PHP code to retrieve some data. The query itself works perfectly within SQL, but when I use it within my PHP script it says "Error in Query" then recites the entire SQL statement. If I copy and paste the SQL statement from the error message directl...