Instead of using $this->fetchAll('email = ?',$email)->current() inside the model class, is there a way to do $this->fetchByEmail($email) or $this->findByEmail($email) ?
There's already a magic method like this for Zend_Log, where instead of $myLogger->log("Something went wrong",Zend_Log::CRIT) you just write $myLogger->crit("Something w...
Ok so i want to do a prepared insert such as:
prepare("INSERT INTO `analyzeditemsdetails` SET
analyzeditem_id = ? ,
start_time = ? ,
end_time = ?
");
start_time and end_time are stored ...
I'm struggling with the automated data collection of a PHP script from a webserver. The files in question contain meteo data and are updated every 10 minutes. Weirdly enough, the 'file modified' date on the webserver doesn't change.
A simple fopen('http://...')-command tries to get the freshest version of the last file in this directory...
Is it time()?
Is it time().substr(microtime(), 2, 2)?
Is it time().substr(microtime(), 2, 3)?
Kind of lost with the following snippet.
function updateClock ( ) {
var timeStamp = <?php echo time().substr(microtime(), 2, 2);?>;
var currentTime = new Date ( );
currentTime.setTime( timeStamp );
...
...
}
My goal is t...
This is a follow up to this question.
Here is my schema
CREATE TABLE A(
id serial NOT NULL,
date timestamp without time zone,
type text,
sub_type text,
filename text,
filepath text,
filesize integer,
lock_status int
);
In this database, a user can update the type,sub-type,filename,filepath,fil...
I am creating a multipage form in PHP, using a session. The $stage variable tracks the user's progress in filling out the form, (UPDATE) and is normally set in $_POST at each stage of the form.
On the second page (stage 2), the form's submit button gets its value like this:
echo '<input type="hidden" name="stage" value="';
echo $stage ...
I need to connect to a MS SQL Server on Windows from PHP running on Red Hat Enterprise Linux 4. I have installed FreeTDS and I can connect to the database using the tsql command.
My current PHP does not have the mssql functions/extension.
My question is, how do I set up the mssql extension without rebuilding PHP?
Is there a prebuilt pa...
What surprises have other people found with writing PHP web applications? There's the well known and to be fixed issue with compile time class inheritance but I know of a couple others and wanted to try and build a list of the top gotcha's of the language.
Note:
I've held several positions as a Sr. PHP5 developer so PHP work pays my ...
Okay, maybe this is because I've been coding for over 24 hours and my eyes are glazing over, but I'm stumped here. Why does this happen:
<?php
session_start();
$tmp = "index";
echo "A: " . $_SESSION['page_loaded']['index']; // returns 1
echo "B: " . $_SESSION['page_loaded'][$tmp]; // is set, but is empty
?>
I feel like I'm missing s...
What code snippets are out there for detecting the language of a chunk of UTF-8 text? I basically need to filter a large amount of spam that happens to be in Chinese and Arabic. There's a PECL extension for that, but I want to do this purely in PHP code. I guess I need to loop through a Unicode string with a unicode version of ord() and ...
What is the Perl equivalent of PHP's $_FILES? I've got some software that sends log files to a web server and I need to retrieve them using Perl instead of PHP. I'm using CGI.pm.
Here's the code in PHP:
<?
foreach ($_FILES as $key=>$value)
{
$uploaded_file = $_FILES[$key]['tmp_name'];
}
?>
...
I've written a batch processor that runs multiple threads (pcntl_fork) and I'm getting some weird results when child processes go defunct and don't seem to let go of their resources.
Is there a good code profiler, trace utility I can use to 'watch' the parent process and children to see what is going on?
...
Which is the best way to parse an XML file in PHP ?
First
Using the DOM object
//code
$dom = new DOMDocument();
$dom->load("xml.xml");
$root = $dom->getElementsByTagName("tag");
foreach($root as $tag)
{
$subChild = $root->getElementsByTagName("child");
// extract values and loop again if needed
}
Second
Using the simplexml_load Me...
My hosting service does not currently run/allow svn, git, cvs on their server. I would really like to be able to 'sync' my current source on my development machine with my production server.
I am looking for a pure php/python/ruby version control system (not just a client for a version control system) that does not require any services...
I have two questions related to the FlashMessenger view helper. Both questions are to do this code:
My action method:
private $_messages; // set to $this->_helper->FlashMessenger; in init()
public function loginAction() {
// > login validation <
// Switch based on the result code
switch ($result->getCode()) {
// >...
I'm building an XML page inside of a function, and for some strange reason I don't get the whole thing spit out of the function. I've tried
return $thisXml;
}
echo $thisXML;
and I only get the xml declaration which is in the variable before the function.
If i put an echo in the function, i get everything back as I should.
my page ...
I have a website that is MySQL/PHP. Occasionally, I cannot connect because of
Warning: mysql_connect() [function.mysql-connect]:
User foo has already more than 'max_user_connections' active connections in /home/foo/public_html/utilities.php
I use a discount web host service and can't really prevent it from happening occasionally. (At ...
I am making use of AJAX on my site and I would like to show users progress of a file that is being downloaded by my server.
The download is done by script that outputs a percentage to the shell. I would like to pass this info back to the user using AJAX. How can I do this?
Thank you for any help and direction.
I hope your solutions do...
While parsing an XML File using the XMLReader Method, how do I get the parent node of an element ?
$xml = new XMLReader();
$xml->XML($xmlString);
while($xml->read())
{
$xml->localName; // gives tag name
$xml->value; // gives tag value
// how do I access the parent of this element
}
...
I have a IN/OUT ratio hit counting system on my site. When a user is sent to my site, I grab the referrer, strip the domain, look up the domain and +1 to hits_in. Very simple. What I discovered thou is, if a user refreshes the page, the referrer is resent to the site, and it counts it as another +1. Whats even worse is that if user click...