Hi,
I have an array with times (string) e.g "2:23", "3:2:22" etc.
$times = array("2:33", "4:2:22", "3:22") //loner
I want to find the total sum of all array.
Is there a way that I could add times like "2:33" and "3:33" ("i:s")
thanks
...
I have Drupal 5 View (must be "Views 1" so), which contains Event_StartTime field, which shows up normally for the fields that have a real date inside. But I also have a number of records with Event_StartTime field value like Dec 31 1969 - 8:00pm which looks bad in view and I need to replace them with some custom label, like "No Date Ava...
I have a PHP calendar that lists all of the days of the month in a table. Before the first day of the month I have numbers from the prior month and after the last day of the month are the numbers of the days for the upcoming month.
Here's a photo of the Calendar as it currently looks. As you can see the bottom gray numbers are working ...
Currently in my application the utf8 encoded data is spoiled by internal coding of PHP.
How to make it consistent with utf8?
EDIT:To show examples,please tell me how to output the current internal encoding in PHP?
In php.ini I found the following:
default_charset = "iso-8859-1"
Which means Latin1.
How to change it to utf8,say,what...
In the PHP below if I compare a variable using == it works as I would expect it to, if I use != then my code breaks, can someone explain or help?
$_GET['p'] = 'home';
// DOES NOT work, it will always return "show JS" regardless to what string I have
if ($_GET['p'] != 'home' || $_GET['p'] != 'create.account'){
echo 'show JS';
}else{...
So I have a PHP class called router that takes the URL and explodes it to find the requested component, action and any given values. It then loads the responsible class, runs the action, etc, etc. I am now integrationg user access into the class via an user class.
For each component (which is a class), I have a static class array varia...
Hello, this is part of a security audition, so there is no way to "change" the query.
Basically, what I found is a flaw that allows statement manipulation, so basically it goes like:
$query = "DELETE FROM `products` WHERE `products`.`whatever` = $variable";
This is PHP, so as far as I know there is no way to execute multiple queries....
This is what I tried so far,by modifying php.ini:
default_charset = "utf-8"
This is how MySQL is configured:
mysql> show variables like '%char%';
+--------------------------+-----------------------------------------------+
| Variable_name | Value |
+--------------------------+-----...
I'm playing around with cookies. And I dont have any cookies called PHPSESSID.
Do i need it? Can i remove it?
Whats the "function" of it?
if (count($_POST)) {
setcookie("TestCookie", htmlspecialchars($_POST['val']), time()+3600);
}
print_r($_COOKIE);
Prints:
Array
(
[TestCookie] => blabla
[PHPSESSID] => el4ukv0kqbvoirg7nk...
Is it possible to prepend an associative array with literal key=>value pairs? I know that array_unshift() works with numerical keys, but I'm hoping for something that will work with literal keys.
As an example I'd like to do the following:
$array1 = array('fruit3'=>'apple', 'fruit4'=>'orange');
$array2 = array('fruit1'=>'cherry', 'frui...
I am storing files into an image field in SQL server storing the string in hex after converting into using:
unpack("H*hex", $datastring);
If I read from the database and write to a file, then open the file locally I can open it up just fine. But if I try to send the file as an attachment to the browser the file becomes corrupted and u...
I get this everytime I use mysql_connect() no matter what database I choose:
Warning: mysql_connect() [function.mysql-connect]: Can't connect to MySQL server on 'IP' (111) in filename.php on line 17
A MySQL error has occurred: Can't connect to MySQL server on 'IP' (111)
The exact same file works on my personal website fine. I have trie...
I'm trying to scrape a page where the information I'm looking for lies within:
<tr class="defRowEven">
<td align="right">label</td>
<td>info</td>
</tr>
I'm trying to get the label and info out of the page. Before I was doing something like:
$hrefs = $xpath->evaluate("/html/body//a");
That is how I'm grabbing the URL's. Is t...
session id is not unique between 1.php and 2.php.
1.php basically sets $_SESSION['var'] = "hello"
and 2.php: print_r($_SESSION['var'])
echoing out session_id() shows different id. same browser (firefox).
everything was working fine, until I screwed up the .htaccess. I deleted .htaccess and restarted apache2.
...
Simple question. Why use require_once to include classes that you use within a file? For example, if I create a class that extends Zend_Db_Table_Abstract, I don't really need to have this in the class declaration file:
require_once "Zend/Db/Table/Select.php";
They are included by the auto-loader anyway. Is there a performance gain for...
I am working on a signup form, I am using PHP and on my processing part I run some code, if a submitted item fails I then add it to an errors array.
Below is a snip of the code, I am at the point where I need to find the best method to determine if I should trigger an error.
So if there is a value set in the error array then I need t...
Hi,
I'm planning on making a self-moderated site where people ca share specific information on tons of items. It will be as following:
If the item a site visitor is looking for isn't available, he can create it. Registration is not needed. Other visitors would help correct his item name if it's invalid.
Visitors can add information to...
I'm working on a long string grabbed from a Session that uses "§" (Section sign) to group and divide different parts of the string.
Example: "ArticleID | Title | Date § ArticleID | Title | Date § ArticleID | Title | Date"
I want to put this into an array using:
explode("§",$str);
However, for some reason the character is totally ignor...
I made this function to verify a user's twitter credentials. Its running on two different webservers.
<?
function twitauth($username, $password){
if(@file_get_contents("http://".$username.":".$password."@twitter.com//account/verify_credentials.xml")){
return "1";}
else {
return "0";}
}
?>
On my webserver, it works fine. On t...
Having never worked with ORM before I thought I would give it a try today, I've come across my first problem that I don't know how to solve (due to my lack of understanding how ORM really works.)
Say I have three tables: Languages, Codes, and a pivot table Codes_Languages. These all have properly defined relationships in the models.
No...