I am generating a csv file from a PHP array. It opens just fine in Excel and OpenOffice Calc, however the data in one of the column are zip codes. Excel makes the cell formats of the column number general by default. This results in the leading 0 getting dropped in zip codes. Is there any way I can specify the cell formats within the...
This is a query I am doing with mysql using PHP
This is the query line
<?php
$query = "SELECT * FROM node WHERE type = 'student_report' AND uid = '{$uid}' LIMIT 1 ORDER BY created DESC";
?>
I get the following error
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right synt...
I created the following script to query a table and return the first 30 results. The query returns 30 results, but they do not have any text or information. Why would this be?
The table stores Vietnamese characters. The database is mysql4.
Here's the page: http://saomaidanang.com/recentposts.php
Here's the code:
<?php
header( 'Co...
Hi
I am facing an Error : execution time for the action exceeded .. secs. In PHP.
I am using set_time_limit(0);
and it is working fine on windows. but it is not working on linux.
what might be the reason?
Thanks & Regards
Rahul
...
Assuming I have a Config class that I use to access the config vars from everywhere (Config::X).
Is it possible to implement a function that can be called from outside the class that adds and/or modifies properties?
Something like this is what I'm thinking of:
class Config
{
const myVar = 'blah';
public static function write( ...
I am converting a PDF with PDF2SWF and Indexing with XPDF.. with exec.. only this requires the execution time to be really high.
Is it possible to run it as background process and then launch a script when it is done converting?
...
Hello,
Is it true that the syntax for (assign of variable value) is different than the syntax for (assign of address) in PHP.
Like:
If we want to store variable value to another variable then we can do it like this:
$b=2;
$a=$b;
print $a;
print $b;
// output is 22
But if we want to store variable address to another variable then we ...
Usage case: In order to handle acces rights for a web application without having to check them each time a page is displayed, I came up with this sheme:
When an administrative user grants or removes access rights to an application user, check if there is a session currently associated with him. Case being, alter session data.
Does php5...
I've spent the last week developing code to connect to a Web Service using the nuSoap library. I just deployed the code to production, but immediately started getting error's that I hadn't seen before. I traced the problem back to a line of code that is trying to instantiate a new soapclient object. It turns out that both libraries have ...
I am trying to store a json encoded array into a MySQL field. The stored array is in the form:
['value1', 'value2', 'value3']
Then I try and run a query like:
SELECT * FROM mytable WHERE arrayfield
it returns no results. The arrayfield is either blank or contains an array, so I am trying to get the records that only contain an array ...
Hi there again. I have a problem with including files on remote server (but on my local Windows PHP+Apache configuration it works fine...).
Problem occurs when I try to include file from included file like this:
Contents of index.php:
<?php
include("Dir1/File1.php");
?>
Contents of Dir1/File1.php:
<?php
include("File2.php");
inc...
How can I replace a string containing a lot of ?myuser=12122 ?myuser=5457 ... with empty string so that it doesn't show ?myuser=number inside the string?
I think I should use regex?
...
How to list files in a directory in "last modified date" order? (PHP5 on Linux)
...
I'm trying to figure out how to use Zend_Db_Table_Abstract correctly. I want to return just the name column from my query. Can you please explain what's wrong with the following code?
class Model_DbTable_Foo extends Zend_Db_Table_Abstract
{
protected $_name = 'foo';
public function getFooById($id) {
$select = $this->select(tr...
I have a singleton db connection which I get with:
$dbConnect = myDatabase::getInstance();
which is easy enough. My question is what is the least rhetorical and legitimate way of using this connection in functions and classes? It seems silly to have to declare the variable global, pass it into every single function, and/or recrea...
I'm wondering if this kind of thing will ever be possible in PHP (and whether it already is and I'm just missing something...)
<?php
function test() {
return array(
'id'=>10,
'name'=>'John'
);
}
echo 'Your name is: '.test()['name'];
?>
I'd really like to be able to use returned arrays directly instead of first assigning them ...
In essence, I have a value that I have to call a couple times in my SQL query. Thus, is it possible to reuse the same named placeholder in the statement e.g.
SELECT :Param FROM Table WHERE Column = :Param, then simply bindValue(":Param"), and have the value be there for both :Params?
...
I am trying to do the following:
<?php foreach($sqlResult as $row): ?>
<tr>
<?php foreach($formdata['columns'] as $column): ?>
<td><?php echo $row->$column['name']; ?></td>
<?php endforeach; ?>
</tr>
<?php endforeach; ?>
This does not work.
$row is returned by my mysql query, it has the following :...
I am looking for the best open source scripts for city-guide sites. Any suggestions?
...
when I use fopen function , why don't I use r+ always , even when I'm not going to write any thing ... is there a reason for separating writing/reading process from only reading ..
like , the file is locked for reading when I use r+ , because i might write new data into it or something ...
another question : in php manual
a+ : Ope...