php

Difference between array_map, array_walk and array_filter

Hi, What exactly is the the difference between array_map, array_walk and array_filter. What I could see from documentation is that you could pass a callback function to perform an action on the supplied array. But I don't seem to find any particular difference between them. Do they perform the same thing? Can they be used interchangeab...

how i can i change the content of a page without refreshing.

how i can i change the content of a page without refreshing.I know we need to use hidden frames for this but all the tutorials i have come across teach this only for HTML files what if the content is returned from a PHP file how do i do it in such a case? what should the php file echo or return? ...

Check if any variables are passed in a GET

I've done a few searches and not come up with anything, I'm sure it's obvious. Basically I'm trying to work out if anything has been passed via GET from a form. I know how to check for individual elements, but I just want to do a quick check if anything at all is passed Cheers ...

Changing hours to days

Editing the question. I have SQL like this: `table1`.`DateField` >= DATE_SUB(NOW(), INTERVAL {$days} DAY Now 24 hours make a whole day. However, what if I want to do the query for the last 3 hours or so? My table1.DateField is in the format of 2010-03-10 10:05:50. Original post: If I have this 1 hour 2 hours 3 hours .. 24 h...

Process for pulling data from a sql database

I want to make a program that pulls objects from a sql database and processes the objects against a set of functions before returning the data to the user. It will work like this: User specifies a date range in a javascript form. The date range is sent to a php file on the server that converts it to a sql query. The sq...

Using addChild with an index position

Hi guys, How can I choose it's position based on it's sibblings when I add a child node ? Here is an example : <?php $_XML = ' <Test> <Menu> <Link href="page1.htm" /> <Link href="page2.htm" /> <Link href="page4.htm" /> ...

sql date hour conversion

I have SQL like this: `table1`.`DateField` >= DATE_SUB(NOW(), INTERVAL {$days} DAY My table1.DateField is in the format of 2010-03-10 10:05:50. The value of {$days} could be 4 hours or 3 days. How can I make the above sql smart enough to know that? Should I use `table1`.`DateField` >= DATE_SUB(NOW(), INTERVAL {$days} DAY_HOUR ...

How would my web page examples look like before mod rewrite when using PHP.

I want to display all my tags on one web page for example, www.example.com/tags/ and then when some one clicks on one of the tags I want to display all the posts related to that tag on another web page for example, www.example.com/tags/clicked-tag/ how would I be able to do this since it really would not be a good idea to create a web ...

PHP function to validate array

Is there a function which I could give an array, which would return true if the provided function returned true for all of them? theFunction(array(1,2,3) , 'is_numeric') //true theFunction(array(1,"b",3) , 'is_numeric') //false ...

How to set default translator in configs.ini ?

Hi, I'm using Zend Framework 1.10.7 and I'm looking for a way to set the default translator. I know I could set it in Bootstrap.php but I would like to set it up in the configs.ini to gather most of my generic config. I guess it needs to specify a registry key (registry_key ?). By the way, does the Zend_Controller_Router use this defa...

Testing if property exists

I read on php docs that isset is faster than property_exists and we should use a combination of both like if (isset($this->$fld) || property_exists($this, $fld)) { But why can't I just use isset then? if (isset($this->$fld)) { ...

Can't Insert into MySQL Table using PHP

Having trouble inserting new records into a table. Anybody care to help? <?php include('config.php'); ?> <?php if(!empty($_POST['forename']) && !empty($_POST['surname']) && !empty($_POST['email']) && !empty($_POST['emailconfirm']) && !empty($_POST['password'])) { if($_POST['email'] == $_POST['emailconfirm']) { $forename = ...

How do i store a swf file name and location in mySQL database?

Hi, Problem, I cannot pre-view a flash movie in a php.page. Question, How, where, do i store a swf file name and location in mySQL database and then use this data to call it in the application? Thanks for reading Sabby77 ...

Load links in a CSS frame?

I am using this script to load pages in a css frame (div#maincontent). I want the links in the loaded pages to load in this frame instead of just "going" there. I want to do this using jquery. Here is my attempt: $('#maincontent a').click(function(e) { e.preventDefault(); ajaxpage($(this).attr("href"), 'maincontent'); }); ...

Simple online store

I don't want to use wordpress (with wp-ecommerce plugin) or other full-featured store scripts because my requirement is quite simple and limited: 2 product types: bags, tees 3 categories: classic, modern, special 3 sort options: by color, by category, by price Cart with PayPal as payment processor. Is there any lightweight (and open-s...

How to update phone numbers for an employee in a database using PHP

I've got a form that allows the user to edit an employees information: name, email, technician level, etc. Well this is not hard in itself, I'm trying to find a good method for updating phone numbers for each employee. I have two tables (that are relevant): technicians and phones. My form allows the user to add, remove and edit any amoun...

Magento website server migration issues

Hello friends, I'm currently in the process of transferring my magento instalation, alog with its database, to a new web server. I edited the config files so they would match the new domain's database data, and uploaded the same files to the other server. When I'm trying to run the system, I get the following error: Warning: include_...

How to get table value with jQuery, run PHP function then append result to table.

1: I'm loading a table onclick as follows: $(document).ready(function() { $("#myTable").tablesorter(); $("#ajax-append").click(function() { $.get("get_data.php", function(html) { $("#myTable tbody").append(html); $("#myTable").trigger("update"); }); return false; }); ...

How to avoid big switch statements?

I have an internal application in which one function is containing too many switch cases. This is developed in php.This specific function is used to write changes to database and also to keep a history of individual field values. So what it does is have a case for each field as different things needs to be applied for different fields...

graphing years of server temperature data

I have a couple of HP M5 servers that I've been collecting temperature reference data for a year now. The problem I have is with graphing this with PHP. I've tried half a dozen methods from Google chart to SWF charts and JS but all seem cumbersome due to the large amount of data. How could I graph this data successfully and easily?< ...