I'm coding a simple web report system for my company. I wrote a script for index.php that gets a list of files in the "reports" directory and creates a link to that report automatically. It works fine, but my problem here is that readdir( ) keeps returning the . and .. directory pointers in addition to the directory's contents. Is there ...
I'm accepting a string from a feed for display on the screen that may or may not include some rubbish I want to filter out. I don't want to filter normal symbols at all.
The values I want to remove look like this: �
It is only this that I want removed. Relevant technology is PHP.
Suggestions appreciated.
...
Hi, I need to get the current time, in Hour:Min format can any one help me in this.
Thanks in advance
Shibin
...
I have an array, i tried writing
array_push($json['Request']['Header'], "key" => "val");
but i received an error. Writing the below works but it adds an array instead of just the key/val
array_push($json['Request']['Header'], array("key" => "val"));
..
[0] => Array
(
[key] => val
)
//i would like
...
[ke...
I need the best way of finding how many numbers in a string, would I have to first remove everything but numbers and then strlen?
Also how would I go about testing the performance of a any PHP script I have written, say for speed and performance under certain conditions?
UPDATE
say I had to inlcude ½ half numbers, its definetly preg t...
I know this is possible in Javascript but I need to do it using only PHP, how can I?
...
i updated and installed php to 5.2.11 yet 5.1.2 was still being used. I did a search of all php5 binaries and replaced it with a hardlink to php (which says 5.2.11 when writing -v). However, after doing a cold boot apache2 is still using 5.1.2. AFAIK i dont have any binaries left of 5.1.2 and my current json code doesnt run (in apache......
How do i convert an associate array to an XML string? I found this but get the error 'Call to a member function addChild() on a non-object' when running the line
$node = $xml->addChild($key);
...
Are there any recent PHP Manuals, the CHMs with the user-contributed notes out there?
The PHP guys seem to have 'dropped support' for them.
Are some of them lurking around the PHP website itself, accessible by their unlinked URLs only?
...
I've not come across an error like this before where Line 0 is referred to. Does it have a specific meaning, or is it simply that PHP was unable to determine the line number before something went wrong?
The full warning is:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /xxxxxx/text_editor.php o...
Is there a way to grab the columns name of a table in mysql?
using php
...
Hi, i have a table with 2 columns tid and nid columns, i need to prepare a report to get common nodes between a tid. i.e table is like (tid, nid) (mysql,2) (mysql,3) (ajax,1) (ajax, 2)
now i need to get what what are the common nodes between ajax and mysql which is node2.
i am looking for a query or some logic with database query in...
I'm building a Magento shop for a customer and would like to add an attribute to all products that functions as a dropdown list. Like the 'Manufacturer' attribute.
However, instead of manually entering the list of values for the attribute I'd like the values to be populated from an external site. So, every time you create a new product ...
I'm familiar with advanced OOP features like interfaces, abstractions, enums, generics, public , private , static keywords, exceptions, etc from Java. However, I'd like to know how all these things translate to PHP.
Specifically I'd like one tutorial or website which goes through all the advanced OOP features of PHP which were added in ...
I have done some digging through perldoc and the O'Reilly books but haven't found any way to do this. Am I relegated to using something like Readonly?
UPDATE:
I have nothing against Readonly. I just wanted to be able to do something like PHP's constant().
Example if Perl had constant():
use constant {
FIELD_EXAMPLE_O => 345,
...
Given this PHP code:
<a onclick="javascript:window.location.href='<?php echo $url;?>'"
What if there is a ' in $url?
I tried using json_encode($url) but it won't be able to handle this.
...
Why should I usefunction __construct() instead of function className() in PHP 5?
...
I would like to create a view that has a single column. If my two tables looked like the following:
Table 1:
ID | Name
1 | Joe
Table 2:
ID | Address
1 | 123 BlueBerry St.
The view would look like:
View:
newcolumn |
Joe
123 Blueberry St.
The reason I do this is because I have an autocomplete text box that searchs a single colum...
Hi,
I have created a table in PHP but the cells size is not fixed it expends when the input is long. Here is the Code.
echo "<div style=\"overflow-y: scroll; white-space: nowrap; height: 190px;\">\n";
echo "<table cellspacing=\"1\" cellpadding=\"1\" align=\"center\" width=\"100%\" id=\"clients\">\n";
echo "<tr bgcolor=\...
I am going to be making a small user system but I have questions.
If I were to make a registration table (mysql), what is wrong with just storing the password and username into the database without encryption?
I am trying to think of how to build the admin portion. Should I just check a column in the database to see if user is admin or...