php

PHP - How to loop through a associative array and get the key name?

My associative array: $arr = array( 1 => "Value1" 2 => "Value2" 10 => "Value10" ); Using the following code, $v is filled with $arr's values foreach($arr as $v){ echo($v); // Value1, Value2, Value10 } How do I get $arr's keys instead? foreach(.....){ echo($k); // 1, 2, 10 } ...

how to implement mvc in core php

how is mvc architecture used in php without any framework? ...

<o:p>&nbsp;</o:p> < o : p > & nbsp ; < / o : p > display error

Hello Whenever i receive an email from MS outlook i get this tag < o : p > & nbsp ; < / o : p > (without the spaces) which display's as ? in a <>. Browser page charset encoding is UTF-8 when i change it to ISO-8859-1 the symbol disappears but my other characters goes wrong. I have to use UTF-8 How can i remove this tag sequence. PHP ...

How to fetch top 20 results of particular keyword from AOL Search Engine using PHP?

Hi,all I want top 20 results of AOL search engine but I don't know how can I get using PHP script ? Please Help me. ...

PHP/MYSQL - Backing up mysql data that changes by the second.

I have a mysql table (A) that's taking in hundreds to thousands of inserts per second. Every 15 minutes I'd like to move all that data to table (B) and delete all the data from (A) without interrupting/missing the new rows going in. Suggestions? Tips? ...

How to test Webservices with PHPUnit?

I neet to test a couple of SOAP webservices. What types of tests can I run? ...

PHP: using variables in associative arrays?

Hi, it seems I missed something important about arrays in PHP. What's wrong with this: var $condition = array('Status.name = ' => 'PUBLISHED'); var $paginate = array('conditions' => $condition ); this works just fine: var $paginate = array('conditions' => array('Status.name = ' => 'PUBLISHED' )); ...

How to work with join data in codeigniter?

Hi, I am having a play around with codeigniter and trying to get my head around the active record system and such like. I have set up a couple of tables and am attempting to run a join on them, as such: function GetOrganisationsAndBuildingDetails() { $this->db->select('organisations.organisation_name, organisations.organisatio...

Opening a Word document using the PHP COM object

Hi guys, I've got some code that generates a word document, as follows: $word->Documents [1]->SaveAs ( $localDir . $filename ); Now, I was kinda hoping that I could now open the file once it's saved by doing the following: $word->Documents->Open($remoteDir . $filename) // remotedir = 'word/', so for example the above would be '/wor...

Use of XML for Model class and structuring

Hi there, I am currently working on a little application: The structure follows in some way the MVC pattern. For short it has the basic things, Models, Controllers etc. Now I am sitting here and do not know whether : 1. The SQL database is only managed by a model through methods the programmer gives him like: "Hey we have name reco...

Php/MySql Help needed

I am very new to php and MySql, but I am writing a project for school on ticket reservation. I need help with: creating a table in a db that has specified number of rows and the rows increase by mulitples of the specified number (Example: say I have a table for Bus A that has 15 seats so I want d db table to contain 15 rows but has the...

PHP: How to capture browser window screen with php?

Hi, First of all, i am not sure, if it is possible to capture browser window screen with php, then how to do it? If it is possible, the best will be to capture just the website content excluding browser parts such as menubar, toolbar, statusbar, etc. Thanks ...

Connected run-time RSS to TwitterFeed

I am creating RSS at runtime using PHP. I connected the link to TwitterFeed, but it is not submitting tweets to Twitter. Is it compulsory that the URL file name must have the extension .xml? ...

Mysql Join, PHP

Just before i put the line of code in let me explain what i am trying to achieve. Id like to query a table where a specific page has a specific parent_id. Once i have all the results i would then like to take the id of the page which has this specific parent_id and fetch all its relative page parts from another table. Then i simpl...

Anyway to bring up the 'Open / Save' dialogue for the user?

Not sure if the title makes sense sorry... basically I'm generating Word documents that I wanted to open automatically on the client's machine, but it seems this isn't possible, so instead of just presenting a list and having them manually click on each one, I was wondering if at the very least it could bring up the 'Would you like to sa...

Security vulnerabilities in php fwrite?

Hi All, I recently transitioned my companies website over to our in-house servers (Apache) from a hosting companies (IIS). The group that originally built the site did a piss poor job and the entire thing was a mess to migrate. While the move went fairly smoothly, looking at the error_log there are still some missing pages. Rather ...

Ajax Grid field grouping

I reasearch modern Ajax Grids capable of grouping rows by fields (into collapsible sections), in a manner similar to ExtJs Grid grouping. Important requirements to such a grid is not only grouping, but grouping (sorting) by multiple fields, e.g. by country and gender. Ideally user needs to be able to select fields to group by (sort by) d...

MD5 File Hashing - match Delphi output with PHP md5_file function

I'm currently using this code for md5 hashing in Delphi 7: function MD5(const fileName : string) : string; var idmd5 : TIdHashMessageDigest5; fs : TFileStream; begin idmd5 := TIdHashMessageDigest5.Create; fs := TFileStream.Create(fileName, fmOpenRead OR fmShareDenyWrite) ; try result := idmd5.AsHex(idmd5.HashValue(fs)) ; ...

PHP & HTMl Mix in a PHP $Var

Mixing html and php is simple: <? while($row): ?> <p><?=$row['name'] ?></p> <?php endwhile; ?> But how could i store html like this into a php variable? (Purposed syntax, but doesn't work) <? $html = ?> <p>My HTML!!</p> <? ; ?> ...

Only match word outside a HTML statement with a regex

The thing I want to achieve with the code below: match a specified word case-insensitive and only once in a text and replace it with a link. I have the following preg_match to match the word 'foo' in a string: if (preg_match("/\bfoo\b/i", $text, $results, PREG_OFFSET_CAPTURE)) { // substr_replace the word 'foo' for a link <a href.. ...