php5

How do I work with constructs in PHPUnit?

I am new into PHPUnit, and just digging through the manual. I cannot find a decent example of how to build a complete test from end to end though, and so, am left with questions. One of these is how can I prep my environment to properly test my code? I am trying to figure out how to properly pass various configuration values needed for...

MySQL & PHP Parameter 1 as Resource

Alright, PHP is throwing this error at me (in the log) when I run the code mentioned below: Error mysql_num_rows() expects parameter 1 to be resource, string given in (place) on line 10 Line 9-11 $queryFP = ("SELECT * FROM db"); $countFP = mysql_num_rows($queryFP); $aID = rand(1, $countFP); I think it has something to do with the ...

Zend Framework multiple databases

I'm currently using only one database with Zend Framework, but now I have to add ONE MORE. I'm using this code right now: public static function setupDatabase() { $config = self::$registry->configuration; $db = Zend_Db::factory($config->db->adapter, $config->db->toArray()); $db->query("SET NAMES 'utf8'"); self::$reg...

Huge mysql table with Zend Framework

I have a mysql table with over 4 million of data; well the problem is that SOME queries WORK and SOME DON'T it depends on the search term, if the search term has a big volume of data in the table than I get the following error: Fatal error: Allowed memory size of 1048576000 bytes exhausted (tried to allocate 75 bytes) in /home/****/pu...

MySQL & PHP Use of Undefined Constant

Alright, PHP is throwing this error (only in the logs): Error PHP Notice: Use of undefined constant department - assumed 'department' (line 5) PHP Notice: Use of undefined constant name - assumed 'name' (line 6) PHP Notice: Use of undefined constant email - assumed 'email' (line 7) PHP Notice: Use of undefined constant message - as...

php code execution time

Hi How to find my code execution time , Am using the below snippet, am not happy with that ? list ($msec, $sec) = explode(' ', microtime()); $microtime = (float)$msec + (float)$sec; Regards ...

Error logging/handling on application basis?

Hi everybody, We have a web server that we're about to launch a number of applications on. On the server-level we have managed to work out the error handling with the help of Hyperic to notify the person who is in charge in the event of a database/memcached server is going down. However, we are still in the need of handling those event...

Zend Framework table Relationships

I have a table with over 4 million rows, I want to split this table in more tables, i.e one table with 50k rows. I also need to perform a search on these tables, whats the best way to do it? with JOIN, or? do you have some better ideas? Best Regards, QUERY $do = $this->select() ->where('branche LIKE ?',''.mys...

Call to a member function get_segment() error

I'm having this problem with this piece of PHP code: class Core { public function start() { require("funk/funks/libraries/uri.php"); $this->uri = new uri(); require("funk/core/loader.php"); $this->load = new loader(); if($this->uri->get_segment(1) != "" and file_exists("funk/pages/".$uri->get_segment(1).".php")){ Only a snippet of th...

Return specific HREF attribute using Xpath query

Having a major brain freeze, I have the following chunk of code: // Get web address $domQuery = query_HtmlDocument($html, '//a[@class="productLink"]'); foreach($domQuery as $rtn) { $web = $rtn->getAttribute('href'); } Which obviously gets the entire href attribute, however I only want 1 specific attribute within the href....

How do I go about using ReflectionFunction on filter_input() ?

This is what I got so far; <?php ReflectionFunction::export(new ReflectionFunction(filter_input())); And I get this error: Warning: filter_input() expects at least 2 parameters, 0 given in C:\wamp\www\POS\Ch4\inspect_filter_input_function.php on line 2 If I get rid of the parentheses, I get a warning but I the function's info. If I p...

Array filteration PHP

I have an array with values like: Array ( [0] => Array ( [parent] => Basic [parentId] => 1 [child] => Birthday [childId] => 2 ) [1] => Array ( [parent] => Basic [parentId] => 1 [child] => Gender [childId] => 3...

PHP: Prevent a function from returning value?

Hi everybody, How could I make sure that the startProcess(); function is being called, but without halting the execution for myFunction(). I'll guess that there's a way to call a function and prevent it from returning it's value to thereby accomplishing this? Pseudo-code: function myFunction() { startProcess(); return $someth...

PHP: Collect all variables passed to a function as array?

Hi everybody, I was thinking about the possibility of accessing all the variables that are passed into an function, and merge them into an array. (Without passing variables into an array from the beginning) Pseudo-code: // Call function newFunction('one', 'two', 'three' ) ;// All values are interpreted as a one rray in some way // Fu...

Is directly linking to an image okay for images uploaded to the server with a custom PHP script?

For an image file (JPEG) that has been uploaded to the server via a PHP script (to a directory such as http://www.somedomain.com/images, is it a good idea to allow the client to get the image's direct address (such as http://www.somedomain.com/images/someimage.jpg and paste it into a WYWSIWYG text editor (such as TinyMCE)? I am wonderin...

sqlite : Fatal error: Call to undefined function sqlite_escape_string()

Hello, I use a script who recquires SQLITE, on my previous hoster, it works, on local it works, on my new dedicaced server, it doesn't, i use PHP5 of course, on this link, you have a phpinfo() of the server. http://bit.ly/bXlLT1 Could you tell me what/how (apt get?) to install correctly sqlite to avoid this fatal error? Thanks ...

How Session Works?

Any body can explain me how session works in PHP. for eg. 3 users logged into gmail. how the server identifies these 3 uers. what are the internel process behind that. ...

what is the main difference between PHP4 and PHP5

what is the main difference between PHP4 and PHP5 ...

adding remote files to a zip file

Is there a way to add files to a zip file from another server with php's zip extension? ie. addFile(array('localfile.txt,'http://www.domain.com/remotefile.txt')) (that obviously does not work) I suppose I can download the files to a temporal folder and then add them to the zip file, but I was looking for a more automated solution or a f...

Present data get from tcp on webpage without refreshing entire page?

My php script communicates over TCP with C server, is there a way to present data obtained from the server while it does not refresh the entire page, so the data refer to a ajax script? ...