Occasionally I'll write a PHP function with a single input, an associative array containing all of that function's inputs. This has benefits such as not having to remember the correct order of inputs, but I've also noticed it makes implementing changes to large codebases much easier; when I need to add another variable, and that variable...
looking into multi file - drag and drop - upload scripts.
we were using swfupload until flash 10 destroyed it.
the other options we are investigating are java and google gears.
what would you recommend and do you know of libraries/examples/frameworks that support these options like the swfupload.
thanks,
Josh
...
Hi,
I'm working on an XML webservice (in PHP!), and in order to do things 'right', I want to use XMLWriter instead of just concatinating strings and hoping for the best.
I'm using XML namespaces everywhere using ->startElementNS and ->writeElementNS. The problem, is that every time I use these functions a new namespace declaration is a...
I've been using the DateTime class in PHP because date() has the downsides of Unix Timestamp. However, neither approach detects invalid dates for months which don't have 31 days but attempt to use the 31st day.
Example Code:
try {
$date = new DateTime('02/31/2018');
$formattedDate = $date->format('Y-m-d');
} catch (Exception $e) {}
ech...
I am setting up validation following the tutorial at link text
My form action script is as follows:
<form method="POST" action="formproc_to_paypal.php" id="example"
target="_self" onsubmit="CalcAmount (this); ReadForm(this);" name="example">
When I remove/change the action line to "" (as the tutorial shows) the validation works ...
Hey everyone,
I'm trying to get PDFlib support into PHP, but after finally figuring out how to install PDFlib, I get this error:
Fatal error: Uncaught exception 'PDFlibException' with message 'Function must not be called in 'object' scope'
Using the example code on php.net:
<?php
// create handle for new PDF document
$pdf = pdf_new...
I am coding in php and the code takes data from an array to fetch additional data from a mysql db. Because I need data from two different tables, I use nested while loops. But the code below always only prints out (echo "a: " . $data3[2]; or echo "b: " . $data3[2];) one time:
foreach($stuff as $key)
{
$query3 = "SELECT * FROM foobar...
Quick question. Is there a difference between
$success = true;
and
$success = 'true';
I know they are not '==' to each other, but is there a difference in using them?
EDIT: I found that using '===' instead of '==' when seeing if $success is false solved my problem. My question now is that, should I just use strings in a case like...
I occasionally come across pages where some Javascript is included via a PHP file:
<html>
<head>
<script type="text/javascript" src="fake_js.php"></script>
</head>
<body onload="handleLoad();">
</body>
</html>
where the contents of fake_js.php might look something like this:
<?php header('Content-type: text/javascript') ...
I have a simple file called index.php. I need to pass it a querystring that will be stored inside a never-expiring cookie. The file looks exactly like this :
<?php
if (isset($_GET['referrer_id']))
{
$querystringWithJunk = $_GET['referrer_id'];
$querystringArray = explode('/', $querystringWithJunk);
setcookie("referrer_id",...
How would I get something like this to work?
$class_name = 'ClassPeer';
$class_name::doSomething();
...
Hi,
I have the following code
$result = $handle->select()->from('store_products_id', array('count'=>'COUNT(store_products_id.product_id)'))
->where('store_products_id.store_id=?', $this->store_id)
->columns($selectColumns)
...
Hey everyone,
Maybe I am missing something but I can't seem to figure this one out.
I have a ReWriteRule:
RewriteRule ^view/(\w+)$ view.php?mmdid=$1 [L]
and when I go to mydomain.org/view/3, the $_GET array is empty. There is no key 'mmdid'.
However, when I change my rule to something else, such as:
RewriteRule ^viewz/(\w+)$ view....
I want my product, like every other web product out there, to pull a data information from my database and convert it to the user's timezone before displaying it on a page. I am using PHP and MySQL.
Is the use of TIMESTAMP fields more common than the use of DATETIME fields?
From my research, it seems that using DATETIME fields, I would...
I'm trying to extract the structure of an XML document in PHP without expanding the entities within. I'm aware that entities are usually expanded before the structure is parsed, and that ignoring this means that the XML may not be well-formed, but I'm parsing XML fragments which might not include the normal XML document header, and so wi...
I just found myself copying and pasting the same code twice.
Right now I have one function that I want to share between two source files. It will pass the same variables from both source files. If I don't want to "repeat myself" would this be the best course of action? If both files have other functions that are separate should these...
I know how to make the download occur, when the download happens it appends the html from the web page that causes the download. How do I filter out the HTML?
...
If possible, using only standard PHP functions like substr(), strrpos(), strpos(), etc.
...
After enabling strict warnings in PHP 5.2, I saw a load of strict standards warnings from a project that was originally written without strict warnings:
Strict Standards: Static function Program::getSelectSQL() should not be abstract in Program.class.inc
The function in question belongs to an abstract parent class Program and is de...
I've been tasked with adding a modal based UI feature to an internal application. The quick summary is that I am posting a form via a modal panel, and I'm wondering the best way to cleanly provide feedback.
Firefox permits changing the page showing within the modal panel via a normal post, but IE opens it in a new window which seems ...